Page MenuHomePhorge

matcher.rs
No OneTemporary

matcher.rs

use fuzzy_matcher::FuzzyMatcher;
use fuzzy_matcher::skim::SkimMatcherV2;
pub struct Matcher {
/// The search pattern that we want to match against some text
pub pattern: String,
matcher: SkimMatcherV2,
}
impl Matcher {
pub fn new(pattern: String) -> Self {
return Self {
pattern,
matcher: SkimMatcherV2::default(),
}
}
pub fn score(self: &Self, text: String) -> i64 {
if let Some((score, _indices)) = self.matcher.fuzzy_indices(&text, &self.pattern) {
return score;
}
return 0;
}
}

File Metadata

Mime Type
text/plain
Expires
Apr 6 2026, 3:07 PM (5 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16041
Default Alt Text
matcher.rs (591 B)

Event Timeline