Expand description
An encapsulation of BufReader’s buffer management logic.
This module factors out the basic functionality of BufReader in order to protect two core
invariants:
filledbytes ofbufare always initializedposis always <=filledSince this module encapsulates the buffer management logic, we can ensure that the rangepos..filledis always a valid index into the initialized region of the buffer. This means that user code which wants to do reads from aBufReaderviabuffer+consumecan do so without encountering any runtime bounds checks.