Trait BufWrite

Source
pub trait BufWrite: BufInterest {
    // Required methods
    fn write_buf<F, T, E>(&mut self, func: F) -> Result<T, E>
       where F: FnOnce(&mut BytesMut) -> Result<T, E>;
    fn do_io<Io: Write>(&mut self, io: &mut Io) -> Result<()>;
}
Expand description

trait generic over different types of write buffer strategy.

Required Methods§

Source

fn write_buf<F, T, E>(&mut self, func: F) -> Result<T, E>
where F: FnOnce(&mut BytesMut) -> Result<T, E>,

write into BytesMut with closure that output a Result type. the result type is used to hint buffer to stop wanting to flush IO on BufWrite::do_io or revert BytesMut to previous state before method was called.

Source

fn do_io<Io: Write>(&mut self, io: &mut Io) -> Result<()>

write into IO from buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§