You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
546 B
Rust

//! Module implementing the `print!`/`println!` macro.
use core::fmt;
use crate::console;
/// The backend for printing to the console.
pub fn _print(args: fmt::Arguments) {
console().write_fmt(args).unwrap();
}
/// The printing macro.
#[macro_export]
macro_rules! print {
($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*)));
}
/// The line printing macro.
#[macro_export]
macro_rules! println {
() => ($crate::print!("\n"));
($($arg:tt)*) => ({
$crate::print::_print(format_args_nl!($($arg)*));
})
}