Just starting to (try to) learn Rust. How do I use "bytestrings" as keys in a std::collections::BTreeMap?
It seems like I can't use [u8] because the type requires a fixed size.
Using vectors, e.g.
BTreeMap<Vec<u8>, MyType>
...seems wasteful.
I could try concatting all the bytestrings into one Vec and use slices of that as the BTree keys, but is there a better way to do this?
Vec
by itself is pretty bare-bones, just a pointer, a length, and a capacity. Shrinking it could be useful, as could putting it all in one place and just using slices (which are just a pointer and a length). What's the ballpark number of keys and how long are they on average? Is it worth worrying about this level of minutia (a.k.a. have you benchmarked)? ^_^ - Shepmaster