Crates.io | readers |
lib.rs | readers |
version | 0.1.0 |
source | src |
created_at | 2023-11-29 09:14:13.740647 |
updated_at | 2023-11-29 09:14:13.740647 |
description | Read Stream |
homepage | |
repository | |
max_upload_size | |
id | 1052756 |
size | 13,934 |
use readers::*;
use std::io::BufReader;
fn main() -> std::io::Result<()> {
std::fs::write("1", b"Hello,")?;
std::fs::write("2", b"Rust!")?;
let f1 = std::fs::File::open("1")?;
let f2 = std::fs::File::open("2")?;
let mut readers = StreamReaders::new();
readers.push(f1)?;
readers.push(f2)?;
let mut reader = BufReader::new(readers);
let mut buf = String::new();
reader.read_to_string(&mut buf)?;
assert_eq!("Hello,Rust!", buf.as_str());
Ok(())
}