dioxide/std/
print.rs

1use core::fmt::Write;
2
3use crate::hal;
4
5pub fn _print(args: core::fmt::Arguments) {
6  hal::console::console().write_fmt(args).unwrap();
7}
8
9/// Prints without a newline.
10///
11/// Carbon copy from <https://doc.rust-lang.org/src/std/macros.rs.html>
12#[macro_export]
13macro_rules! print {
14    ($($arg:tt)*) => ($crate::std::print::_print(format_args!($($arg)*)));
15}
16
17/// Prints with a newline.
18///
19/// Carbon copy from <https://doc.rust-lang.org/src/std/macros.rs.html>
20#[macro_export]
21macro_rules! println {
22    () => ($crate::print!("\n"));
23    ($($arg:tt)*) => ({
24        $crate::std::print::_print(format_args_nl!($($arg)*));
25    })
26}
27
28// temporary identical impl to _print
29pub fn _eprint(args: core::fmt::Arguments) {
30  hal::console::console().write_fmt(args).unwrap();
31}
32
33/// Prints without a newline.
34///
35/// Carbon copy from <https://doc.rust-lang.org/src/std/macros.rs.html>
36#[macro_export]
37macro_rules! eprint {
38    ($($arg:tt)*) => ($crate::std::print::_eprint(format_args!($($arg)*)));
39}
40
41/// Prints with a newline.
42///
43/// Carbon copy from <https://doc.rust-lang.org/src/std/macros.rs.html>
44#[macro_export]
45macro_rules! eprintln {
46    () => ($crate::print!("\n"));
47    ($($arg:tt)*) => ({
48        $crate::std::print::_eprint(format_args_nl!($($arg)*));
49    })
50}