Module buf_redux::policy

source ·
Expand description

Types which can be used to tune the behavior of BufReader and BufWriter.

Some simple policies are provided for your convenience. You may prefer to create your own types and implement the traits for them instead.

Structs

Flag for ReaderPolicy methods to signal whether or not BufReader should read into the buffer.
Flag for WriterPolicy methods to tell BufWriter how many bytes to flush to the underlying reader.
Flush the buffer if it contains at least the given number of bytes.
Only ever flush exactly the given number of bytes, until the writer is empty.
Flush the buffer if it contains the given byte.
Flush the buffer if it contains a newline (\n).
A policy for BufReader which ensures there is at least the given number of bytes in the buffer, failing this only if the reader is at EOF.
Default policy for both BufReader and BufWriter that reproduces the behaviors of their std::io counterparts:

Traits

Trait that governs BufReader’s behavior.
A trait which tells BufWriter when to flush.