pub trait Write {
// Required methods
fn write(&mut self, buf: &[u8]) -> Result<usize, IoError>;
fn flush(&mut self) -> Result<(), IoError>;
// Provided methods
fn write_all(&mut self, buf: &[u8]) -> Result<(), IoError> { ... }
fn write_fmt(&mut self, args: Arguments<'_>) -> Result<(), IoError> { ... }
fn by_ref(&mut self) -> &mut Self
where Self: Sized { ... }
}Expand description
A trait for objects which are byte-oriented sinks.
See [std::io::Write] for more details.
Required Methods§
Provided Methods§
Sourcefn write_all(&mut self, buf: &[u8]) -> Result<(), IoError>
fn write_all(&mut self, buf: &[u8]) -> Result<(), IoError>
Attempts to write an entire buffer into this writer.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Write for BorrowedCursor<'_, u8>
impl Write for BorrowedCursor<'_, u8>
Implementors§
impl Write for &Empty
impl Write for &Sink
impl Write for Cursor<&mut Vec<u8>>
Available on crate feature
alloc only.impl Write for Cursor<&mut [u8]>
impl Write for Cursor<Box<[u8]>>
Available on crate feature
alloc only.impl Write for Cursor<Vec<u8>>
Available on crate feature
alloc only.