#io-read #iterator #read #reader

iter-read

A Read implementation for iterators over u8 and related types

7 releases (2 stable)

1.0.1 Nov 30, 2023
0.3.1 Jan 24, 2022
0.3.0 Jun 17, 2020
0.2.1 Sep 18, 2019
0.1.0 Apr 24, 2016

#154 in Rust patterns

Download history 10572/week @ 2023-11-27 16481/week @ 2023-12-04 11685/week @ 2023-12-11 11192/week @ 2023-12-18 4376/week @ 2023-12-25 11606/week @ 2024-01-01 12320/week @ 2024-01-08 12159/week @ 2024-01-15 12005/week @ 2024-01-22 11170/week @ 2024-01-29 12127/week @ 2024-02-05 12982/week @ 2024-02-12 11571/week @ 2024-02-19 18355/week @ 2024-02-26 21286/week @ 2024-03-04 10111/week @ 2024-03-11

61,962 downloads per month
Used in 80 crates (6 directly)

MIT/Apache

15KB
277 lines

iter-read

Build status Latest Version

Documentation

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.

Installation

This crate works with Cargo and can be found on crates.io with a Cargo.toml like:

[dependencies]
iter-read = "1.0"

Requirements

Minimum supported Rust version is 1.48.0. No other dependencies.

Usage

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");

No runtime deps

Features