[−][src]Function concat_reader::concat_path
pub fn concat_path<I: IntoIterator>(items: I) -> impl FileConcatRead where
I::Item: AsRef<Path>,
Concats multiple file paths into a single reader over all files.
use concat_reader::{FileConcatRead, concat_path}; use std::io::{self, Read, BufRead, BufReader, Write}; fn main() -> io::Result<()>{ let files = vec!["/path/to/file_1", "/path/to/file_2", "/path/to/file_3"]; let mut f = concat_path(files); let mut buffered = BufReader::new(f); let stdout = io::stdout(); let mut handle = stdout.lock(); loop { let mut line = String::new(); let r = buffered.read_line(&mut line)?; if r == 0 { return Ok(()) } let f = buffered.get_ref().file_path(); eprintln!("read from {:?}", f); handle.write(line.as_bytes())?; } }