Crates.io | ensured_bufreader |
lib.rs | ensured_bufreader |
version | 0.2.0 |
source | src |
created_at | 2019-09-29 09:29:30.618577 |
updated_at | 2019-10-04 09:37:05.950062 |
description | A Bufreader ensures N bytes in buffer. |
homepage | |
repository | https://github.com/IgaguriMK/ensured_bufreader |
max_upload_size | |
id | 168590 |
size | 35,167 |
ensured_bufreader
provides EnsuredBufReader
that ensured length bytes in its buffer if it can read from underlying reader.
std::io::BufReader
doesn't read bytes from underlying reader if it has buffered bytes.
This behavior is better if you need buffering for performance.
But, if you need buffering for algorithm such as peeking N bytes, BufReader
donesn't ensure N bytes in its buffer.
If there are too few bytes in buffer when .fill_buf()
called, EnsuredBufReader
tries to read additional bytes from underlying reader and keep .fill_buf()?.len() > ensured
.
buffered-reader
provides same functionality as this crate.
But there is some differences.
ensured_bufreader |
buffered-reader = "0.10.0" |
|
---|---|---|
Implementation strategy | Uses standard trait BufRead and simple wrapper struct |
Provides new trait and some implementaions |
When returns error | Immediately | Saved and returned when read position error occuered |
License | MIT or Apache-2.0 (permissive) | GPL-3.0 (copyleft) |
ensured_bufreader
is distributed under the terms of both the MIT license and the Apache License (Version 2.0).
See LICENSE-APACHE and LICENSE-MIT.