1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
use arch::debug; use core::fmt::{Error,Write}; #[derive(Clone)] pub struct Writer; impl Writer { pub fn get(module: &str) -> Writer { use core::fmt::Write; let mut writer = Writer; let _ = write!(&mut writer, "[{}] ", module); writer } } impl Write for Writer { fn write_str(&mut self, s: &str) -> Result<(), Error> { debug::puts(s); Ok(()) } }