Crates.io | iter-read |
lib.rs | iter-read |
version | 1.1.0 |
source | src |
created_at | 2016-04-24 11:49:48.122553 |
updated_at | 2024-08-24 15:17:07.139159 |
description | A Read implementation for iterators over u8 and related types |
homepage | |
repository | https://github.com/birkenfeld/iter-read |
max_upload_size | |
id | 4835 |
size | 28,023 |
iter-read
This crate is a small library that provides a type that implements
std::io::Read
for iterators over bytes (u8
) and sequences of it, and also
Result<u8, E>
, Result<Vec<u8>, E>
etc.
This crate works with Cargo and can be found on
crates.io with a Cargo.toml
like:
[dependencies]
iter-read = "1.0"
Minimum supported Rust version is 1.58.0. No other dependencies.
A simple example:
use std::io::Read;
use iter_read::IterRead;
let source = vec![1, 2, 7, 42, 123];
let mut reader = IterRead::new(source.iter());
let mut buf = vec![0; 3];
reader.read_exact(&mut buf).unwrap();
assert_eq!(buf, b"\x01\x02\x07");