fuzzy_search in rust_fuzzy_search - Rust
Description: Use this function to compare a string (`&str`) with all elements of a list.
Keywords: rust, rustlang, rust-lang, fuzzy_search

# Function rust_fuzzy_search::fuzzy_search
[−][src]

    pub fn fuzzy_search<'a>(s: &'a str, list: &'a [&str]) -> Vec<(&'a str, f32)>

Use this function to compare a string (`&str`) with all elements of a list.

The result is a list whose elements are tuples of the form `(string, score)`, the first element being the word of the list and the second element the score.

Arguments:

- `s` : the string to compare.
- `list` : the list of strings to compare with `s`.

example:

    fn test() {
        use rust_fuzzy_search::fuzzy_search;
        let s = "bulko";
        let list : Vec<&str> = vec!["kolbasobulko", "sandviĉo"];
        let res : Vec<(&str, f32)> = fuzzy_search(s,&list);
        for (_word, score) in res {
            println!("{:?}",score)
        }
    }

Run