Skip to main content

UartOps

Trait UartOps 

Source
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§

Source

fn init(&mut self) -> Result<(), UartError>

Initialize the UART device

Source

fn read_byte(&mut self) -> Result<u8, UartError>

Read one byte from the UART device

Source

fn write_byte(&mut self, byte: u8) -> Result<(), UartError>

Write one byte to the UART device

Provided Methods§

Source

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".

Implementors§