pub fn search<'pool>(
    q: &str,
    pool: &'pool impl IntoParallelRefIterator<'pool, Item = &'pool Text>,
) -> Vec<Candidate> {
    let mut matches: Vec<Candidate>;

    if q.is_empty() {
        matches = pool.par_iter().map(|txt| txt.into()).collect();
    } else {
        let query: Query = q.into();
        matches = pool
            .par_iter()
            .map(|c| compute_match(&query, c))
            .filter(|c| c.is_some())
            .map(|c| c.unwrap())
            .collect();

        matches.par_sort_unstable_by(|a, b| b.cmp(a));
    }

    matches
}
/// Search for candidates that fuzzy-match a query
///
/// * If the query is empty it just returns the same pool of candidates
/// * Otherwise it will try to compute the best match for each candidate
///   and then sort them from higher score to lower
Search for candidates that fuzzy-match a query
If the query is empty it just returns the same pool of candidates
Otherwise it will try to compute the best match for each candidate
and then sort them from higher score to lower
Search for candidates that fuzzy - match a query If the query is empty it just returns the same pool of candidates Otherwise it will try to compute the best match for each candidate and then sort them from higher score to lower
pub fn search<'pool>(
    q: &str,
    pool: &'pool impl IntoParallelRefIterator<'pool, Item = &'pool Text>,
) -> Vec<Candidate> {
    let mut matches: Vec<Candidate>;
    if q.is_empty() {
        matches = pool.par_iter().map(|txt| txt.into()).collect();
    } else {
        let query: Query = q.into();
        matches = pool
            .par_iter()
            .map(|c| compute_match(&query, c))
            .filter(|c| c.is_some())
            .map(|c| c.unwrap())
            .collect();
        matches.par_sort_unstable_by(|a, b| b.cmp(a));
    }
    matches
}
pub fn search < ' pool > ( q : & str , pool : & ' pool impl IntoParallelRefIterator < ' pool , Item = & ' pool Text > , ) -> Vec < Candidate > { let mut matches : Vec < Candidate > ; if q . is_empty ( ) { matches = pool . par_iter ( ) . map ( | txt | txt . into ( ) ) . collect ( ) ; } else { let query : Query = q . into ( ) ; matches = pool . par_iter ( ) . map ( | c | compute_match ( & query , c ) ) . filter ( | c | c . is_some ( ) ) . map ( | c | c . unwrap ( ) ) . collect ( ) ; matches . par_sort_unstable_by ( | a , b | b . cmp ( a ) ) ; } matches }
Search for candidates that fuzzy-match a query
 If the query is empty it just returns the same pool of candidates
 Otherwise it will try to compute the best match for each candidate
and then sort them from higher score to lower
Search for candidates that fuzzy - match a query If the query is empty it just returns the same pool of candidates Otherwise it will try to compute the best match for each candidate and then sort them from higher score to lower
q
&str
pool
&'pool impl IntoParallelRefIterator<'pool, Item = &'pool Text>