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.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl BufWrite for BytesMut

source§

impl BufWrite for xitca_http::bytes::WriteBuf

source§

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

source§

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

source§

impl<const LIMIT: usize> BufWrite for xitca_http::util::buffered::WriteBuf<LIMIT>