cargo::util::edit_distance

Function closest

source
pub fn closest<'a, T>(
    choice: &str,
    iter: impl Iterator<Item = T>,
    key: impl Fn(&T) -> &'a str,
) -> Option<T>
Expand description

Find the closest element from iter matching choice. The key callback is used to select a &str from the iterator to compare against choice.