read_iter 0.1.2

To any std::io::Read implementor, add also Iterator<Item=u8> implementation
Documentation
  • Coverage
  • 80%
    4 out of 5 items documented1 out of 5 items with examples
  • Size
  • Source code size: 6.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.15 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jeremiah-shaulov/read_iter
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jeremiah-shaulov

read_iter

Documentation crates.io

To any std::io::Read implementor, add also Iterator<Item=u8> implementation.

Installation

In Cargo.toml of your project add:

[dependencies]
read_iter = "0.1"

Examples

use std::fs::File;
use read_iter::ReadIter;

let file = File::open("/tmp/test.txt").unwrap();
// "file" implements std::io::Read
let mut it = ReadIter::new(file);
// now "it" also implements std::io::Read
// and "&mut it" implements Iterator<Item=u8>
// also "it" has internal buffer, and implements std::io::BufRead
for byte in &mut it
{	// ...
}
// in case of i/o error, the iteration ends, and take_last_error() will return Err
it.take_last_error().unwrap();