11 releases
0.3.0 | Oct 31, 2024 |
---|---|
0.2.1 | Aug 11, 2024 |
0.2.0 | Jul 1, 2024 |
0.1.3 | Mar 31, 2024 |
0.1.0 |
|
#2 in #seek
50 downloads per month
15KB
324 lines
Multiple Readers
multiple-readers
is a Rust library aimed at simplifying the process of combining multiple types that implement the std::io::Read trait into a unified reader.
Features
- Combines multiple types that implement the std::io::Read trait into a unified reader.
- Can read from data sources sequentially until all data sources are exhausted.
- Supports tokio (
Unstable
)
Example
use multi_readers::join_readers;
use std::io::{Cursor, Read};
fn main() -> std::io::Result<()> {
let slice = Cursor::new(b"First-");
let bytes = Cursor::new(b"Second-");
let mut reader = join_readers!(slice, bytes);
let mut buf = String::new();
reader.read_to_string(&mut buf)?;
assert_eq!(buf.as_str(), "First-Second-");
Ok(())
}
Dependencies
~0–5.5MB
~19K SLoC