// SPDX-License-Identifier: MIT // // Copyright (c) 2018-2019 Andre Richter //! Printing facilities. use crate::bsp; use crate::interface; use core::fmt; /// Prints without a newline. /// /// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html #[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::print::_print(format_args!($($arg)*))); } /// Prints with a newline. /// /// Carbon copy from https://doc.rust-lang.org/src/std/macros.rs.html #[macro_export] macro_rules! println { () => ($crate::print!("\n")); ($($arg:tt)*) => ({ $crate::print::_print(format_args_nl!($($arg)*)); }) } pub fn _print(args: fmt::Arguments) { use interface::console::Write; bsp::console().write_fmt(args).unwrap(); }