michaelsproul / rust_radix_trie

Fast generic radix trie implemented in Rust
https://docs.rs/radix_trie/
MIT License
184 stars 32 forks source link

Get prefix of subtrie #34

Closed vks closed 6 years ago

vks commented 6 years ago

Is there some way to get the prefix of a subtrie and convert it back to the original data type?

vks commented 6 years ago

Converting back to the original data type is actually not always possible, because the prefix has 4-bit boundaries, while the original data type might have different ones.

michaelsproul commented 6 years ago

Yes, and even with a vector of bytes, reversing the serialisation might not always work (e.g. you could cut a string half way through a multi-byte Unicode char). We could still have a method returning a Result<K, Error>