Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/birkenfeld/iter-read
Rust library that implements std::io::Read for iterators over bytes
https://github.com/birkenfeld/iter-read
Last synced: 2 months ago
JSON representation
Rust library that implements std::io::Read for iterators over bytes
- Host: GitHub
- URL: https://github.com/birkenfeld/iter-read
- Owner: birkenfeld
- License: apache-2.0
- Created: 2016-04-24T11:40:32.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-19T19:26:52.000Z (about 1 year ago)
- Last Synced: 2024-04-23T20:15:20.431Z (9 months ago)
- Language: Rust
- Homepage:
- Size: 22.5 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
`iter-read`
===========[![Build status](https://img.shields.io/github/actions/workflow/status/birkenfeld/iter-read/main.yml?branch=master&logo=github&style=)](https://github.com/birkenfeld/iter-read/actions)
[![Latest Version](https://img.shields.io/crates/v/iter-read.svg)](https://crates.io/crates/iter-read)[Documentation](https://docs.rs/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`, `Result, E>` etc.Installation
============This crate works with Cargo and can be found on
[crates.io](https://crates.io/crates/iter-read) with a `Cargo.toml` like:```toml
[dependencies]
iter-read = "1.0"
```Requirements
============Minimum supported Rust version is 1.58.0. No other dependencies.
Usage
=====A simple example:
```rust
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");
```