Function fuzzy_match::fuzzy_match [−][src]
pub fn fuzzy_match<'a, T, It>(needle: &str, haystack: It) -> Option<T> where
It: IntoIterator<Item = (&'a str, T)>,
Fuzzy finds a set of string-item pairs using a Sorensen Dice coefficient and Levenshtein for breaking ties. May
return None if no match is similar. This consumes the input vector. See
fuzzy_match_with_algorithms
for additional details.
Examples
use fuzzy_match::fuzzy_match; let haystack = vec![("rust", 0), ("java", 1), ("lisp", 2)]; assert_eq!(Some(0), fuzzy_match("bust", haystack));
Panics
This function will panic if the haystack is empty (length 0).