use fuzzy_matcher::skim::SkimMatcherV2;
use fuzzy_matcher::FuzzyMatcher;
use once_cell::sync::Lazy;
static MATCHER: Lazy<SkimMatcherV2> = Lazy::new(|| SkimMatcherV2::default().ignore_case());
pub trait Fuzzy {
fn fuzzy_match(&self, other: &str) -> bool;
fn fuzzy_score(&self, other: &str) -> i64;
}
impl Fuzzy for str {
fn fuzzy_match(&self, other: &str) -> bool {
MATCHER.fuzzy_match(self, other).is_some()
}
fn fuzzy_score(&self, other: &str) -> i64 {
MATCHER.fuzzy_match(self, other).unwrap_or(0)
}
}