Trait Write

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

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

Required Methods§

Source

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

Tries to write the contents of the provided buffer into this writer returning how many bytes were written.

§Errors

Writer failing to write

Source

fn flush(&mut self) -> Result<()>

Flushes this Writer

§Errors

Formatting the provided arguments, or the Writer failing to write

Provided Methods§

Source

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

Writes the full buffer into this Writer

§Errors

Writer failing to write

Source

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

Writes format arguments into this Writer

§Errors

Formatting the provided arguments, or the Writer failing to write

Source

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Get this Writer as a mutable reference

Implementors§