macros.rs 605 B

1234567891011121314151617181920212223
  1. // Ref: rcore-console crate
  2. #[allow(unused)]
  3. macro_rules! print {
  4. ($($arg:tt)*) => {
  5. use core::fmt::Write;
  6. let mut console = $crate::console::CONSOLE.lock();
  7. console.write_fmt(core::format_args!($($arg)*)).unwrap();
  8. drop(console);
  9. }
  10. }
  11. #[allow(unused)]
  12. macro_rules! println {
  13. () => ($crate::print!("\n"));
  14. ($($arg:tt)*) => {{
  15. use core::fmt::Write;
  16. let mut console = $crate::console::CONSOLE.lock();
  17. console.write_fmt(core::format_args!($($arg)*)).unwrap();
  18. console.write_char('\n').unwrap();
  19. drop(console);
  20. }}
  21. }