pub struct FuzzyTrie<T> { /* private fields */ }
Expand description

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

Creates new fuzzy trie with given distance and dameru params

Creates new fuzzy trie from given config

Inserts value to trie Returns inserter, to make possible using the value field as a key See Inserter for additional information

Makes fuzzy search with given key and puts result to out collector See Collector for additional information

Makes fuzzy search on prefix with given key and puts result to out collector See Collector for additional information

Iterator over values

Destructs self into inner vec of values

Len of inner values vector

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.