A copy of Levenshtein distance implementation from Rust Compiler.
The Rust Compiler has Symbol
for internal usage.
However, it is not necessary in general and replaced with String
.
```rust use levdistance::findbestmatchfor_name;
fn main() { let v = vec!["aaa", "bbb"]; let lookup = "aa";
if let Some(sugg) = match find_best_match_for_name(v.iter(), "aa", None) {
Some(sugg) if sugg == name => None,
sugg => sugg,
} {
println!("Did you mean `{}`?", sugg);
}
} ```
shell
$ cargo run
Did you mean `aaa`?