Crates.io | multi_reader |
lib.rs | multi_reader |
version | 0.1.0 |
source | src |
created_at | 2016-08-24 21:18:48.136914 |
updated_at | 2016-08-24 21:18:48.136914 |
description | MultiReader - a composite reader implementation. |
homepage | |
repository | https://github.com/Ostrovski/multi_reader.rs |
max_upload_size | |
id | 6097 |
size | 7,107 |
Like std::io::Chain
but allows to chain more than two readers together.
extern crate multi_reader;
use std::env;
use std::io::{BufRead, BufReader};
use std::fs::File;
fn main() {
let args: Vec<_> = env::args().collect();
let files = args[1..].iter().map(|f| File::open(f).expect("File not found"));
let reader = BufReader::new(multi_reader::MultiReader::new(files));
println!("Total lines count: {}", reader.lines().count());
}
Run cargo run --example main chained /path/to/file/a /path/to/file/b ...
.
cargo test