pub fn filter(self, matcher: Matcher, query: &str) -> Result<Vec<FilterResult>> {
        let do_match = |line: &str| matcher.do_match(&line.into(), query);

        let filtered = match self {
            Self::Stdin => std::io::stdin()
                .lock()
                .lines()
                .filter_map(|lines_iter| {
                    lines_iter.ok().and_then(|line| {
                        do_match(&line).map(|(score, indices)| (line.into(), score, indices))
                    })
                })
                .collect::<Vec<_>>(),
            #[cfg(feature = "enable_dyn")]
            Self::Exec(exec_cmd) => std::io::BufReader::new(exec_cmd.stream_stdout()?)
                .lines()
                .filter_map(|lines_iter| {
                    lines_iter.ok().and_then(|line| {
                        do_match(&line).map(|(score, indices)| (line.into(), score, indices))
                    })
                })
                .collect::<Vec<_>>(),
            Self::File(fpath) => std::fs::read_to_string(fpath)?
                .par_lines()
                .filter_map(|line| {
                    do_match(&line)
                        .map(|(score, indices)| (line.to_string().into(), score, indices))
                })
                .collect::<Vec<_>>(),
            Self::List(list) => list
                .filter_map(|item| {
                    let line = item.match_text();
                    do_match(line).map(|(score, indices)| (line.into(), score, indices))
                })
                .collect::<Vec<_>>(),
        };

        Ok(filtered)
    }
/// Returns the complete filtered results after applying the specified
/// matcher algo on each item in the input stream.
///
/// This is kind of synchronous filtering, can be used for multi-staged processing.
Returns the complete filtered results after applying the specified
matcher algo on each item in the input stream.

This is kind of synchronous filtering, can be used for multi-staged processing.
Returns the complete filtered results after applying the specified matcher algo on each item in the input stream . This is kind of synchronous filtering can be used for multi - staged processing .
pub fn filter(self, matcher: Matcher, query: &str) -> Result<Vec<FilterResult>> {
        let do_match = |line: &str| matcher.do_match(&line.into(), query);
        let filtered = match self {
            Self::Stdin => std::io::stdin()
                .lock()
                .lines()
                .filter_map(|lines_iter| {
                    lines_iter.ok().and_then(|line| {
                        do_match(&line).map(|(score, indices)| (line.into(), score, indices))
                    })
                })
                .collect::<Vec<_>>(),
            #[cfg(feature = "enable_dyn")]
            Self::Exec(exec_cmd) => std::io::BufReader::new(exec_cmd.stream_stdout()?)
                .lines()
                .filter_map(|lines_iter| {
                    lines_iter.ok().and_then(|line| {
                        do_match(&line).map(|(score, indices)| (line.into(), score, indices))
                    })
                })
                .collect::<Vec<_>>(),
            Self::File(fpath) => std::fs::read_to_string(fpath)?
                .par_lines()
                .filter_map(|line| {
                    do_match(&line)
                        .map(|(score, indices)| (line.to_string().into(), score, indices))
                })
                .collect::<Vec<_>>(),
            Self::List(list) => list
                .filter_map(|item| {
                    let line = item.match_text();
                    do_match(line).map(|(score, indices)| (line.into(), score, indices))
                })
                .collect::<Vec<_>>(),
        };
        Ok(filtered)
    }
pub fn filter ( self , matcher : Matcher , query : & str ) -> Result < Vec < FilterResult > > { let do_match = | line : & str | matcher . do_match ( & line . into ( ) , query ) ; let filtered = match self { Self :: Stdin => std :: io :: stdin ( ) . lock ( ) . lines ( ) . filter_map ( | lines_iter | { lines_iter . ok ( ) . and_then ( | line | { do_match ( & line ) . map ( | ( score , indices ) | ( line . into ( ) , score , indices ) ) } ) } ) . collect :: < Vec < _ > > ( ) , # [ cfg ( feature " " ) ] Self :: Exec ( exec_cmd ) => std :: io :: BufReader :: new ( exec_cmd . stream_stdout ( ) ? ) . lines ( ) . filter_map ( | lines_iter | { lines_iter . ok ( ) . and_then ( | line | { do_match ( & line ) . map ( | ( score , indices ) | ( line . into ( ) , score , indices ) ) } ) } ) . collect :: < Vec < _ > > ( ) , Self :: File ( fpath ) => std :: fs :: read_to_string ( fpath ) ? . par_lines ( ) . filter_map ( | line | { do_match ( & line ) . map ( | ( score , indices ) | ( line . to_string ( ) . into ( ) , score , indices ) ) } ) . collect :: < Vec < _ > > ( ) , Self :: List ( list ) => list . filter_map ( | item | { let line = item . match_text ( ) ; do_match ( line ) . map ( | ( score , indices ) | ( line . into ( ) , score , indices ) ) } ) . collect :: < Vec < _ > > ( ) , } ; Ok ( filtered ) }
Returns the complete filtered results after applying the specified
matcher algo on each item in the input stream.
Returns the complete filtered results after applying the specified matcher algo on each item in the input stream .
self
matcher
Matcher
query
&str