[−][src]Struct fuzzy_trie::FuzzyTrie
FuzzyTrie is a trie with a LevensteinAutomata to make fuzzy searches
Example
use fuzzy_trie::FuzzyTrie; let mut trie = FuzzyTrie::new(2, false); trie.insert("vanilla").insert("vanilla item"); trie.insert("hello").insert("hello item"); trie.insert("helo").insert("helo item"); trie.insert("vanllo").insert("vanllo item"); let mut hello = Vec::new(); trie.fuzzy_search("hello", &mut hello); let mut hello_iter = hello.into_iter(); assert_eq!(hello_iter.next(), Some((0, &"hello item"))); assert_eq!(hello_iter.next(), Some((1, &"helo item"))); assert_eq!(hello_iter.next(), None); let mut vanila = Vec::new(); trie.fuzzy_search("vanilla", &mut vanila); let mut vanila_iter = vanila.into_iter(); assert_eq!(vanila_iter.next(), Some((0, &"vanilla item"))); assert_eq!(vanila_iter.next(), Some((2, &"vanllo item"))); assert_eq!(vanila_iter.next(), None);
Implementations
impl<T> FuzzyTrie<T>
[src]
pub fn new(distance: u8, damerau: bool) -> Self
[src]
Creates new fuzzy trie with given distance and dameru params
pub fn new_with_config(config: &Config) -> Self
[src]
Creates new fuzzy trie from given config
pub fn insert<'a>(&'a mut self, key: &str) -> Inserter<'a, T>
[src]
Inserts value to trie
Returns inserter, to make possible using the value field as a key
See Inserter
for additional information
pub fn fuzzy_search<'a, C: Collector<'a, T>>(&'a self, key: &str, out: &mut C)
[src]
Makes fuzzy search with given key and puts result to out collector
See Collector
for additional information
pub fn iter(&self) -> Iter<T>
[src]
Iterator over values
pub fn into_value(self) -> Vec<T>
[src]
Destructs self into inner vec of values
pub fn len(&self) -> usize
[src]
Len of inner values vector
Auto Trait Implementations
impl<T> RefUnwindSafe for FuzzyTrie<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for FuzzyTrie<T> where
T: Send,
T: Send,
impl<T> Sync for FuzzyTrie<T> where
T: Sync,
T: Sync,
impl<T> Unpin for FuzzyTrie<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for FuzzyTrie<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,