pub trait Write {
// Required methods
fn write(&mut self, buf: &[u8]) -> Result<usize>;
fn flush(&mut self) -> Result<()>;
// Provided method
fn write_all(&mut self, buf: &[u8]) -> Result<()> { ... }
}
Expand description
A trait for objects that provide streaming write capability.
Required Methods§
sourcefn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
Write a buffer to a stream.
Semantics match std::io::Write::write()
.
sourcefn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
Commit any outstanding buffered writes to underlying storage.
Semantics match std::io::Write::flush()
.