Skip to main content

Crate rstrie

Crate rstrie 

Source
Expand description

A trie library for Rust that allows generic implementing a generic Trie.

A Trie actually does not store keys directly but supports storing the individual fragments of what composes a key. For instance, a String trie will use char and will have the signature Trie::<char, ()> (Trie).

The Trie supports the entire API of the standard library’s HashMap along with various common algorithms that a Trie data structure should support. This Trie implementation is optimized for extensibility and supporting many types and may not necessarily be the most memory optimized.

§Example

use rstrie::Trie;

let mut trie = Trie::<char, usize>::new();
trie.insert("hello".chars(), 4);
trie.insert("hey".chars(), 5);

assert_eq!(trie.get("hello".chars()), Some(&4));

Structs§

CompletionIter
Drain
EntryIterMut
An iterator created by consuming the Trie. Contains all the entries of the Trie.
EntryIterRef
An iterator created by consuming the Trie.
IntoEntryIter
An iterator created by consuming the Trie.
KeyIter
An iterator created by consuming the Trie.
PostfixIter
Trie
A Trie is a data structure that is commonly used to store and retrieve strings in a memory-efficient manner. This crate takes a slightly different approach, allowing for the building of Tries from arbitrary types as long as they can satisfy certain properties.
ValueIter
An iterator created by consuming the Trie.
ValueIterMut
An iterator over the values of a Trie that provides mutable references.
ValueIterRef
An iterator over the values of a Trie.
ValueSlot

Enums§

TryGetKeyMapError

Type Aliases§

StrTrie
A Trie that is implemented for String types. As textual data is the most common usecase for the Trie, they get some special attention.