Crates.io | multi-readers |
lib.rs | multi-readers |
version | 0.3.0 |
source | src |
created_at | 2023-12-04 05:45:09.920836 |
updated_at | 2024-10-31 06:05:15.575898 |
description | Combining multiple readers |
homepage | |
repository | https://github.com/cradiy/multi-readers.git |
max_upload_size | |
id | 1057249 |
size | 21,521 |
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.
Unstable
)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(())
}