Expand description
obkv stands for optimized-bytes key and a value store.
The main purpose of this library is to be able to store key value entries where the key can be represented by an optimized amount of bytes, this allows a lot of optimizations.
§Example: Creating an obkv and iterating over the entries
use obkv::{KvWriterU16, KvReaderU16};
let mut writer = KvWriterU16::memory();
writer.insert(0, b"hello").unwrap();
writer.insert(1, b"blue").unwrap();
writer.insert(255, b"world").unwrap();
let obkv = writer.into_inner().unwrap();
let reader: &KvReaderU16 = obkv[..].into();
let mut iter = reader.iter();
assert_eq!(iter.next(), Some((0, &b"hello"[..])));
assert_eq!(iter.next(), Some((1, &b"blue"[..])));
assert_eq!(iter.next(), Some((255, &b"world"[..])));
assert_eq!(iter.next(), None);
assert_eq!(iter.next(), None); // is it fused?Structs§
- KvIter
- An iterator over a
obkvdatabase. - KvReader
- A reader of
obkvdatabases. - KvWriter
- An
obkvdatabase writer.
Traits§
- Key
- A trait that represents a key, this key will be encoded to disk.
Type Aliases§
- KvReader
U8 - A reader that can read
obkvs withu8keys. - KvReader
U16 - A reader that can read
obkvs withu16keys. - KvReader
U32 - A reader that can read
obkvs withu32keys. - KvReader
U64 - A reader that can read
obkvs withu64keys. - KvWriter
U8 - An
obkvwriter that usesu8keys. - KvWriter
U16 - An
obkvwriter that usesu16keys. - KvWriter
U32 - An
obkvwriter that usesu32keys. - KvWriter
U64 - An
obkvwriter that usesu64keys.