A drop-in replacement for Rust's std::io::BufReader
with additional functionality.
Method names/signatures and implemented traits are unchanged from std::io::BufReader
, making replacement as simple as swapping the import of the type:
notest
- use std::io::BufReader;
+ extern crate buf_redux;
+ use buf_redux::BufReader;
Provides methods to:
&
-reference without performing I/OBufReader
without losing dataRead
adapter which empties the buffer and then pulls from the inner reader directly strategy
module:
BufReader
performs reads as dictated by the ReadStrategy
trait.BufReader
shuffles bytes down to the beginning of the buffer, to make more room at the end, when deemed appropriate by the
MoveStrategy
trait.BufReader
uses exact allocation instead of leaving it up to Vec
, which allocates sizes in powers of two.
Cargo.toml
:
toml
[dependencies]
buf_redux = "0.2"
lib.rs
or main.rs
:
rust
extern crate buf_redux;
And then find-and-replace use std::io::BufReader
with use buf_redux::BufReader
using whatever tool you prefer.
Licensed under either of
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.