Crate v_trie

source ·
Expand description

A compressed prefix tree implementation.

Accepted keys are any type with slices that implement Eq. Accepted values are anything that the tree can own.

It is recommended to use static sized numbers or strings. Use u8 if string keys are being used.

Using the Trie with strings requires using the designated string functions; this will automatically turn the string into a slice of u8’s which is compatible with the tree. Unicode equivalency is not checked.

It is not recommended to use the Trie with large structs as the key, as performance will suffer due to the key being cloned into the prefix tree, as opposed to referenced or taken into ownership.

Some unimplemented todos include:

  • Add support for iteration
  • Add support for in-place iteration, without IntoIter

In-place iteration without requiring the usage of Rc’s or unsafe will likely be difficult due to the tree’s unidirectional nature.

Structs

  • Error returned if attempting to set a key with try_set, and the key already exists.
  • Error returned if attempting to remove a key that does not exist.
  • compressed prefix tree