Module buf_redux::strategy [] [src]

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

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

Structs

AtEndLessThan

A MoveStrategy which triggers if there is no more room at the tail at the end of the buffer, and there are fewer valid bytes in the buffer than the provided value.

AtEndLessThan1k

A MoveStrategy which tells the buffer to move data if there is no more room at the tail of the buffer, and if there is less than 1 KiB of valid data in the buffer.

FlushAtLeast

Flush the buffer if it contains at least the given number of bytes.

FlushAtLeast8k

Flush the buffer if it contains at least 8Kb (8192b).

FlushOn

Flush the buffer if it contains the given byte.

FlushOnNewline

Flush the buffer if it contains a newline (\n).

IfEmpty

A ReadStrategy which tells the buffer to read more data only when empty.

LessThan

A ReadStrategy which returns true if there is fewer bytes in the buffer than the provided value.

NeverMove

A MoveStrategy which always returns false. Use this to restore original std::io::BufReader behavior.

WhenFull

Flush the buffer if there is no more headroom. Equivalent to the behavior or std::io::BufWriter.

Traits

FlushStrategy

A trait which tells BufWriter when to flush.

MoveStrategy

Trait for types which BufReader can consult to determine when it should move data to the beginning of the buffer.

ReadStrategy

Trait for types which BufReader can consult to determine when it should read more data into the buffer.

Type Definitions

DefaultFlushStrategy

The default FlushStrategy for this crate.

DefaultMoveStrategy

The default MoveStrategy for this crate.

DefaultReadStrategy

The default ReadStrategy for this crate.