Trait alcs::FuzzyStrstr
[−]
[src]
pub trait FuzzyStrstr<T: AsRef<str>>: AsRef<str> { fn fuzzy_find_pos(&self, s: T, tsh: f32) -> Option<(f32, usize, usize)> { ... } fn fuzzy_find_str<'a>(&'a self, s: T, tsh: f32) -> Option<(f32, &'a str)> { ... } fn fuzzy_contains(&self, s: T, tsh: f32) -> bool { ... } }
Provided Methods
fn fuzzy_find_pos(&self, s: T, tsh: f32) -> Option<(f32, usize, usize)>
Searches s inside self,
It returns:
Some(score,start,end)
if there is a substring s[start..end] achieving a score that is at least the threshold
None
otherwise
For "not too small" values of tsh,
it requires O(|self|+|s|) space and O(|self|*|s|) time
fn fuzzy_find_str<'a>(&'a self, s: T, tsh: f32) -> Option<(f32, &'a str)>
Searches s inside self,
It returns:
Some(score,substring)
if there is a substring achieving a score that is at least the threshold
None
otherwise
For "not too small" values of tsh,
it requires O(|self|+|s|) space and O(|self|*|s|) time
fn fuzzy_contains(&self, s: T, tsh: f32) -> bool
Searches s inside self,
It returns:
true
if there is a substring achieving a score that is at least the threshold
false
otherwise
For "not too small" values of tsh,
it requires O(|self|+|s|) space and O(|self|*|s|) time