driver_interface::io

Trait Write

Source
pub trait Write: Send + Sync {
    // Required methods
    fn write(&mut self, buf: &[u8]) -> IOResult<usize>;
    fn flush(&mut self) -> IOResult;

    // Provided method
    fn write_all(&mut self, buf: &[u8]) -> IOResult { ... }
}

Required Methods§

Source

fn write(&mut self, buf: &[u8]) -> IOResult<usize>

Source

fn flush(&mut self) -> IOResult

Provided Methods§

Source

fn write_all(&mut self, buf: &[u8]) -> IOResult

Write an entire buffer into this writer.

This function calls write() in a loop until exactly buf.len() bytes have been written, blocking if needed.

If you are using [WriteReady] to avoid blocking, you should not use this function. WriteReady::write_ready() returning true only guarantees the first call to write() will not block, so this function may still block in subsequent calls.

This function will panic if write() returns Ok(0).

Trait Implementations§

Source§

impl Write for dyn Write

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

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

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

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

Implementors§