readers

Crates.ioreaders
lib.rsreaders
version0.1.0
sourcesrc
created_at2023-11-29 09:14:13.740647
updated_at2023-11-29 09:14:13.740647
descriptionRead Stream
homepage
repository
max_upload_size
id1052756
size13,934
Karl (blueteary)

documentation

README

Example

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(())
}
Commit count: 0

cargo fmt