nearest

Function nearest 

Source
pub fn nearest<'a>(
    typo: &str,
    among: impl Iterator<Item = &'a str>,
) -> Option<&'a str>
Expand description

The known name closest to typo, when one is close enough to be worth suggesting.

Ordinary Levenshtein distance with a threshold that scales with the word. It is the last of suggestion’s three rules rather than the only one, because the mistakes this vocabulary exists to catch are systematic rather than random.