Crates.io | obkv |
lib.rs | obkv |
version | 0.2.2 |
source | src |
created_at | 2020-10-21 10:30:13.446887 |
updated_at | 2024-07-02 11:45:40.086023 |
description | Optimized-bytes key and a value store |
homepage | |
repository | https://github.com/Kerollmops/obkv |
max_upload_size | |
id | 303804 |
size | 15,543 |
A micro key-value store where the key is always one byte. It is highly inspired by the KVDS crate.
let mut writer = KvWriter::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 = KvReader::new(&obkv);
assert_eq!(reader.get(0), Some(&b"hello"[..]));
assert_eq!(reader.get(1), Some(&b"blue"[..]));
assert_eq!(reader.get(10), None);
assert_eq!(reader.get(255), Some(&b"world"[..]));