pub mod arinae;
pub mod clangd;
pub mod frizbee;
pub mod fzy;
pub mod skim;
mod util;
pub(crate) type IndexType = usize;
pub(crate) type ScoreType = i64;
pub(crate) type MatchIndices = Vec<IndexType>;
pub trait FuzzyMatcher: Send + Sync {
fn fuzzy_indices(&self, choice: &str, pattern: &str) -> Option<(i64, MatchIndices)>;
fn fuzzy_match(&self, choice: &str, pattern: &str) -> Option<i64> {
self.fuzzy_indices(choice, pattern).map(|(score, _)| score)
}
fn fuzzy_match_range(&self, choice: &str, pattern: &str) -> Option<(i64, usize, usize)> {
self.fuzzy_indices(choice, pattern).map(|(score, indices)| {
let begin = indices.first().copied().unwrap_or(0);
let end = indices.last().copied().unwrap_or(0);
(score, begin, end)
})
}
}