Skip to main content

closest_match

Function closest_match 

Source
pub fn closest_match<'a, I>(target: &str, candidates: I) -> Option<&'a str>
where I: IntoIterator<Item = &'a str>,
Expand description

Find the closest match to target from candidates using Levenshtein distance. Returns Some(name) only when the best candidate is within max(target.len() / 3, 1) edits - enough to catch typical typos without surfacing wild guesses.