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§
Sourcefn write(&mut self, buf: &[u8]) -> Result<(), WriteError>
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.
Sourcefn flush(&mut self) -> Result<(), WriteError>
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".