Trait embedded_io::blocking::Write

source ·
pub trait Write: Io {
    // Required methods
    fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>;
    fn flush(&mut self) -> Result<(), Self::Error>;

    // Provided methods
    fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error> { ... }
    fn write_fmt(
        &mut self,
        fmt: Arguments<'_>,
    ) -> Result<(), WriteFmtError<Self::Error>> { ... }
}
Expand description

Blocking writer.

Semantics are the same as [std::io::Write], check its documentation for details.

Required Methods§

source

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

Write a buffer into this writer, returning how many bytes were written.

source

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

Flush this output stream, ensuring that all intermediately buffered contents reach their destination.

Provided Methods§

source

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Write an entire buffer into this writer.

source

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

Write a formatted string into this writer, returning any error encountered.

Implementations on Foreign Types§

source§

impl Write for &mut [u8]

Write is implemented for &mut [u8] by copying into the slice, overwriting its data.

Note that writing updates the slice to point to the yet unwritten part. The slice will be empty when it has been completely overwritten.

If the number of bytes to be written exceeds the size of the slice, write operations will return short writes: ultimately, Ok(0); in this situation, write_all returns an error of kind ErrorKind::WriteZero.

source§

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

source§

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

source§

impl Write for Vec<u8>

Available on crate features std or alloc only.
source§

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

source§

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

source§

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

source§

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

source§

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

source§

impl<T: ?Sized + Write> Write for Box<T>

Available on crate features std or alloc only.
source§

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

source§

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

Implementors§