Más traits
Hemos derivado el trait Debug. También sería útil implementar algunos traits más.
use core::fmt::{self, Write}; impl Write for Uart { fn write_str(&mut self, s: &str) -> fmt::Result { for c in s.as_bytes() { self.write_byte(*c); } Ok(()) } } // SAFETY: `Uart` just contains a pointer to device memory, which can be // accessed from any context. unsafe impl Send for Uart {}
- Implementar
Writenos permite utilizar las macroswrite!ywriteln!con nuestro tipoUart. - Ejecuta el ejemplo en QEMU con
make qemu_minimalensrc/bare-metal/aps/examples.