embedded_hal_nb::serial

Trait Write

Source
pub trait Write<Word: Copy = u8>: ErrorType {
    // Required methods
    fn write(&mut self, word: Word) -> Result<(), Self::Error>;
    fn flush(&mut self) -> Result<(), Self::Error>;
}
Expand description

Write half of a serial interface.

Required Methods§

Source

fn write(&mut self, word: Word) -> Result<(), Self::Error>

Writes a single word to the serial interface.

Source

fn flush(&mut self) -> Result<(), Self::Error>

Ensures that none of the previously written words are still buffered.

Trait Implementations§

Source§

impl<Word, Error: Error> Write for dyn Write<Word, Error = Error> + '_
where Word: Copy + From<u8>,

Implementation of core::fmt::Write for the HAL’s serial::Write.

TODO write example of usage

Source§

fn write_str(&mut self, s: &str) -> Result

Writes a string slice into this writer, returning whether the write succeeded. Read more
1.1.0§

fn write_char(&mut self, c: char) -> Result<(), Error>

Writes a [char] into this writer, returning whether the write succeeded. Read more
1.0.0§

fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), Error>

Glue for usage of the [write!] macro with implementors of this trait. Read more

Implementations on Foreign Types§

Source§

impl<T: Write<Word> + ?Sized, Word: Copy> Write<Word> for &mut T

Source§

fn write(&mut self, word: Word) -> Result<(), Self::Error>

Source§

fn flush(&mut self) -> Result<(), Self::Error>

Implementors§