Trait buf_redux::strategy::FlushStrategy
[−]
[src]
pub trait FlushStrategy: Default + Debug { fn flush_before(&self, _buf: &Buffer, _incoming: usize) -> bool; fn flush_after(&self, _buf: &Buffer) -> bool { ... } }
A trait which tells BufWriter
when to flush.
Required Methods
fn flush_before(&self, _buf: &Buffer, _incoming: usize) -> bool
Return true
if the buffer should be flushed before reading into it.
The buffer is provided, as well as incoming
which is
the size of the buffer that will be written to the BufWriter
.
Provided Methods
fn flush_after(&self, _buf: &Buffer) -> bool
Return true
if the buffer should be flushed after reading into it.
buf
references the updated buffer after the read.
Default impl is a no-op.
Implementors
impl FlushStrategy for WhenFull
impl FlushStrategy for FlushAtLeast
impl FlushStrategy for FlushAtLeast8k
impl FlushStrategy for FlushOn
impl FlushStrategy for FlushOnNewline