Skip to main content

BufWrite

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>(&mut self, io: &mut Io) -> Result<(), Error>
       where Io: Write;
}
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>(&mut self, io: &mut Io) -> Result<(), Error>
where Io: Write,

write into IO from buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§