sparreal_kernel/boot/
debug.rs

1use core::fmt::Write;
2
3use crate::platform_if::PlatformImpl;
4
5pub struct DebugWriter;
6
7impl Write for DebugWriter {
8    fn write_str(&mut self, s: &str) -> core::fmt::Result {
9        write_str(s);
10        Ok(())
11    }
12}
13pub fn write_str(s: &str) {
14    s.bytes().for_each(|ch| {
15        PlatformImpl::debug_put(ch);
16    });
17}
18
19pub fn print(args: core::fmt::Arguments) {
20    let mut writer = DebugWriter;
21    let _ = writer.write_fmt(args);
22}