pub trait UartOps {
// Required methods
fn init(&mut self) -> Result<(), UartError>;
fn read_byte(&mut self) -> Result<u8, UartError>;
fn write_byte(&mut self, byte: u8) -> Result<(), UartError>;
// Provided method
fn write_string(&mut self, string: &str) -> Result<(), UartError> { ... }
}Expand description
Trait which defines standardized UART operations across different serial implementations
Required Methods§
Sourcefn write_byte(&mut self, byte: u8) -> Result<(), UartError>
fn write_byte(&mut self, byte: u8) -> Result<(), UartError>
Write one byte to the UART device
Provided Methods§
Sourcefn write_string(&mut self, string: &str) -> Result<(), UartError>
fn write_string(&mut self, string: &str) -> Result<(), UartError>
Write a string to the serial device
Default implementation calls Self::write_byte for each byte in the string
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".