A QP-Trie implementation for Rust
A qp-trie implementation for Rust
A qp-trie is a fast and compact associative array optimized for short keys.
It is similar to a crit-bit trie, with a larger fan-out per internal node.
It supports the following operations at high speed:
- See whether a key is in the trie and retrieve an optional associated value
- Add a
(key, value)pair to the trie - Remove a key from the trie
- Find all keys matching a given prefix
This implementation uses 4 bits per index and doesn't require strings to be zero-terminated: keys can be made of arbitrary binary data.
Example
extern crate qptrie;
use Trie;
let mut trie = default;
trie.insert;
trie.insert;
let v = trie.get.unwrap;
for in trie.prefix_iter.include_prefix
trie.remove;