Module buffer_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
ReaderPolicymethods to signal whether or notBufReadershould read into the buffer. - Flag for
WriterPolicymethods to tellBufWriterhow 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
BufReaderwhich 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
BufReaderandBufWriterthat reproduces the behaviors of theirstd::iocounterparts:
Traits§
- Trait that governs
BufReader’s behavior. - A trait which tells
BufWriterwhen to flush.