Struct rtrie::TernaryTrie [] [src]

pub struct TernaryTrie<P = u32> where
    P: Priority
{ /* fields omitted */ }

A randomized ternary search trie.

This is a variant of the ternary search tree that uses randomization to ensure that the tree is (typically) balanced. See: Randomized Ternary Search Tries, Nicolai Diethelm:

https://arxiv.org/abs/1606.04042

Methods

impl<P> TernaryTrie<P> where
    P: Priority
[src]

Construct a trie. This constructor has a priority type parameter, This allows the user to specify the type of the priority. E.g. for smaller trees a narrow unsigned could suffice and saves memory.

Returns true when a string is in the trie, or false otherwise.

Since a ternary trie cannot contain the empty string, this method will always return false for an empty string.

Returns the number of nodes in the trie.

Insert a string into the trie.

Since a ternary tree cannot store empty strings, the insert method will panic when inserting an empty string.

Return an iterator over the strings in the trie.

Iterate over the strings starting with the given prefix.

Remove a string from the trie.

Since a ternary tree cannot store empty strings, the remove method will panic when attempting to insert an empty string.

impl TernaryTrie<u32>
[src]

Construct a trie. The random number generator will be used to generate string priorities.

Trait Implementations

impl<'a, P> IntoIterator for &'a TernaryTrie<P> where
    P: Priority
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more