mozilla / rkv

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

implement From<OwnedValue> for Value #123

Closed mykmelez closed 5 years ago

mykmelez commented 5 years ago

Over in https://phabricator.services.mozilla.com/D19436#inline-106713, @mystor wondered why rkv doesn't provide a conversion from OwnedValue to Value, which is indeed a missing piece in rkv's API that requires downstream consumers like kvstore to implement the conversion themselves.

Here's an implementation that enables downstream consumers like kvstore to avoid implementing it themselves. Along the way, I removed unnecessary ref annotations now that rkv specifies edition = "2018" and thus infers the binding mode for match bindings.

mykmelez commented 5 years ago

The build failure is because the latest nightly version of Rust doesn't have rustfmt. It looks like we'll have to go back to pinning a known-to-have-rustfmt version of the nightly toolchain in order to ensure that we can run rustfmt. I did that in 3762a8f.

mykmelez commented 5 years ago

FWIW, the Rust nightly we use could be almost anything other than today's nightly, as at least the last week's worth of nightly builds (besides today's) all have rustfmt, according to https://mexus.github.io/rustup-components-history/x86_64-apple-darwin.html.