Trait pw_stream::Write

source ·
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§

source

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

Write a buffer to a stream.

Semantics match std::io::Write::write().

source

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

Commit any outstanding buffered writes to underlying storage.

Semantics match std::io::Write::flush().

Provided Methods§

source

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

Writes entire buffer to stream.

Semantics match std::io::Write::write_all().

Implementors§

source§

impl<T: AsRef<[u8]> + AsMut<[u8]>> Write for Cursor<T>