FuzzyStrstr

Trait FuzzyStrstr 

Source
pub trait FuzzyStrstr<T: AsRef<str>>: AsRef<str> {
    // Provided methods
    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§

Source

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

Source

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

Source

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

Implementors§

Source§

impl<S, T> FuzzyStrstr<T> for S
where S: AsRef<str>, T: AsRef<str>,