Skip to main content

Write

Trait Write 

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

Custom write abstraction that allows Writer to work without std::io::Write.

This trait is automatically implemented for Vec<u8> and, when the std feature is enabled, for any std::io::Write type.

Required Methods§

Source

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

Write all bytes in buf to the sink.

Returns Err if the write could not be completed.

Source

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

Flush any buffered data to the underlying sink.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<W: Write> Write for W

Available on crate feature std only.