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", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<B, const LIMIT: usize> BufWrite for ListWriteBuf<B, LIMIT>

Source§

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

Source§

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

Source§

impl<const LIMIT: usize> BufWrite for WriteBuf<LIMIT>

Source§

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

Source§

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

Implementors§

Source§

impl BufWrite for BytesMut

Source§

impl BufWrite for xitca_web::bytes::WriteBuf

Source§

impl<L, R> BufWrite for EitherBuf<L, R>
where L: BufWrite, R: BufWrite,