| 1 | `iter-read` |
| 2 | =========== |
| 3 | |
| 4 | [](https://github.com/birkenfeld/iter-read/actions) |
| 5 | [](https://crates.io/crates/iter-read) |
| 6 | |
| 7 | [Documentation](https://docs.rs/iter-read) |
| 8 | |
| 9 | This crate is a small library that provides a type that implements |
| 10 | `std::io::Read` for iterators over bytes (`u8`) and sequences of it, and also |
| 11 | `Result<u8, E>`, `Result<Vec<u8>, E>` etc. |
| 12 | |
| 13 | Installation |
| 14 | ============ |
| 15 | |
| 16 | This crate works with Cargo and can be found on |
| 17 | [crates.io](https://crates.io/crates/iter-read) with a `Cargo.toml` like: |
| 18 | |
| 19 | ```toml |
| 20 | [dependencies] |
| 21 | iter-read = "1.0" |
| 22 | ``` |
| 23 | |
| 24 | Requirements |
| 25 | ============ |
| 26 | |
| 27 | Minimum supported Rust version is 1.58.0. No other dependencies. |
| 28 | |
| 29 | Usage |
| 30 | ===== |
| 31 | |
| 32 | A simple example: |
| 33 | |
| 34 | ```rust |
| 35 | use std::io::Read; |
| 36 | use iter_read::IterRead; |
| 37 | let source = vec![1, 2, 7, 42, 123]; |
| 38 | let mut reader = IterRead::new(source.iter()); |
| 39 | let mut buf = vec![0; 3]; |
| 40 | reader.read_exact(&mut buf).unwrap(); |
| 41 | assert_eq!(buf, b"\x01\x02\x07"); |
| 42 | ``` |