Function did_you_mean

Source
pub fn did_you_mean<T, I>(
    v: &str,
    possible_values: I,
    max_num_of_suggestions: usize,
) -> Vec<String>
where T: AsRef<str>, I: IntoIterator<Item = T>,
Expand description

Finds strings from an iterable of possible_values similar to a given value v. Returns a vector of all possible values that exceed a similarity threshold, sorted by similarity (most similar comes first). The returned vector will have at most max_num_of_suggestions elements.

The implementation is taken and adapted from the Clap project.