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

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

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