3 releases

0.1.2 Jul 14, 2023
0.1.1 Jul 14, 2023
0.1.0 Jul 14, 2023

#505 in Compression

MIT license

14KB
289 lines

v-trie

A generic compressed prefix tree implementation in Rust.

This works on any sliceable sequence where the sequence can by copied; e.g. string, vectors of numbers, etc.

Performance directly depends on iteration and comparison through said slice.


lib.rs:

  • 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.

Dependencies

~4KB