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.

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.

Traits

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.