mozilla / rkv

A simple, humane, typed key-value storage solution.
https://crates.io/crates/rkv
Apache License 2.0
307 stars 52 forks source link

Consider adding a `Value` type for `u8` and `u128`. #189

Open rnewman opened 4 years ago

rnewman commented 4 years ago

This is a bit of a hole/omission.

I was aiming for simplicity when I defined the set of types, and was also following Mentat's type system, which was definitely aimed at higher-level applications; I64 and U64 were sufficient.

I recently find myself doing a lot of stuffing of bitfields/flags into rkv, and it would be convenient to not have to use a 64-bit integer to do it. I doubt there would be significant space savings, or even efficiency in read/write, but it would express intent and give more flexibility to the underlying storage.

Similarly, one can represent a 128-bit integer as a UUID and store it as a Value::Uuid, but it would be neat to be able to use Rust's own u128 (introduced in 1.26) as a value.