stupid-simple-kv
A dead-simple, pluggable, and binary-sorted key-value store for Rust.
Features
- Order-preserving, binary, tuple-style keys using primitives, tuples, or your own struct if you implement IntoKey.
- Pluggable API – just use Rust types for keys and values. Memory and SQLite backends included, or write your own.
- Generic value serialization: Store any serde-serializable Rust value as a
KvValueusing serde_json. - Iteration & filtering: Builder API for range/prefix queries with typed results.
- Custom error types and strict Rust interface.
Installation
Quickstart
use ;
let backend = Boxnew;
let mut kv = new;
let key = .to_key;
// automatically convert compatible value types to KvValue
kv.set?;
let out = kv.get?;
assert_eq!;
kv.delete?;
Iteration & Filtering
let backend = Boxnew;
let mut kv = new;
for id in 0..5
// List all values with prefix (1, _)
let results = kv.list.prefix.entries?; // Vec<(KvKey, KvValue)>
Custom Struct Keys
Just implement IntoKey for your type:
use IntoKey;
SQLite backend
Note: You can choose to not use the SQLite backend by disabling the sqlite
feature.
use ;
let backend = Boxnew;
let mut kv = new;
let key = .to_key;
kv.set?;
JSON Import/Export
- Easily dump the entire key-value store to JSON (human/debug-friendly) with
kv.dump_json(). - Restore or initialize from JSON using
Kv::from_json_string(...). - All keys are dumped as parseable debug strings; values use a type-preserving JSON format.
Example:
let json = kv.dump_json?;
// ...
let mut kv2 = from_json_string?;
License
MIT License © 2025 Siddharth S Singh (me@shantaram.xyz)