Drop-in replacements for buffered I/O types in
These replacements retain the method names/signatures and implemented traits of their stdlib counterparts, making replacement as simple as swapping the import of the type.
All replacement types provide methods to:
BufReader provides methods to:
&-reference without performing I/O
Readadapter which empties the buffer and then pulls from the inner reader directly
LineWriter provide methods to:
BufReaderperforms reads as dictated by the
BufReadermoves bytes down to the beginning of the buffer, to make more room at the end, when deemed appropriate by the
BufWriterflushes bytes to the inner writer when full, or when deemed appropriate by the
Bufferuses exact allocation instead of leaving it up to
Vec, which allocates sizes in powers of two.
[dependencies] buf_redux = "0.2"
extern crate buf_redux;
And then simply swap the import of the types you want to replace:
- use std::io::BufReader; + use buf_redux::BufReader;
- use std::io::BufWriter; + use buf_redux::BufWriter;
- use std::io::LineWriter; + use buf_redux::LineWriter;
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.