[][src]Function sublime_fuzzy::best_match

pub fn best_match(query: &str, target: &str) -> Option<Match>

Returns the best match for query in the target string string.

Always tries to match the full pattern. A partial match is considered invalid and will return None. Will also return None in case query or string are empty.

Note that whitespace in query will be ignored.

Examples

Basic usage:

use sublime_fuzzy::{best_match, Scoring};

let m = best_match("scc", "SoccerCartoonController")
    .expect("No match");

assert_eq!(m.matched_indices().len(), 3);
assert_eq!(m.score(), 172);