Function match_items

Source
pub fn match_items<'a>(query: &str, items: &[&'a str]) -> Vec<(&'a str, usize)>
Expand description

Matches multiple items against the query and returns a sorted vector of tuples containing the item and its match score.

§Arguments

  • query - The search query string slice.
  • items - Slice of string slices to be matched.

§Returns

A vector of tuples (item, score), sorted by descending score.

§Examples

let items = ["fefe", "feature", "banana"];
let results = matchr::match_items("fefe", &items);
assert_eq!(results[0].0, "fefe");