From 5d2f51ab8593946a0f24db367a887a37258901d5 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 3 Jun 2019 02:02:44 +0200 Subject: [WIP] rewrite output logic as a pipeline --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 89dab09..dbb8f36 100644 --- a/src/main.rs +++ b/src/main.rs @@ -285,6 +285,7 @@ fn is_log_file(entry: &DirEntry) -> bool { /// Run the grep search with the given options. fn grep(opt: &Opt) -> Result<(), RuntimeError> { + let pipeline = &output::build_pipeline(opt); rayon::scope(|s| { let walker = WalkDir::new(&opt.path); for entry in walker { @@ -294,7 +295,7 @@ fn grep(opt: &Opt) -> Result<(), RuntimeError> { let search = search_log(&entry, opt); match search { Ok(None) => (), - Ok(Some(result)) => output::output(io::stdout(), opt, &result).unwrap(), + Ok(Some(result)) => pipeline.push_item(&result), Err(err) => { debug!("Runtime error while scanning {:?}: {}", entry.path(), err); } -- cgit v1.2.3