Expand description
§heaplet
A tiny, in-memory, Redis-inspired data structure store for Rust.
heaplet exposes a single Store that holds multiple Redis-like structures
under one key-space. Most APIs are typed (T: serde::Serialize / T: serde::de::DeserializeOwned)
and use a pluggable codec::Codec (default: codec::BincodeCodec).
§Quick start
use heaplet::Store;
let store = Store::new();
// KV / String
store.kv().set("k", &123_i64).unwrap();
let v: Option<i64> = store.kv().get("k").unwrap();
assert_eq!(v, Some(123));
// Hash
let h = store.hash("h");
h.hset("field", &"value").unwrap();
let hv: Option<String> = h.hget("field").unwrap();
assert_eq!(hv.as_deref(), Some("value"));
// Set
let s = store.set("s");
s.sadd(&"a").unwrap();
assert!(s.sismember(&"a").unwrap());
// ZSet
let z = store.zset("z");
z.zadd(2.0, &"b").unwrap();
z.zadd(1.0, &"a").unwrap();
let r: Vec<String> = z.zrange(0, -1).unwrap();
assert_eq!(r, vec!["a".to_string(), "b".to_string()]);§Notes
- Expiration is lazy: expired keys are removed when accessed (e.g.
exists,get,hget). - Scan-style APIs (
scan,hscan,sscan,zscan) are snapshot-based for deterministic paging (MVP).
Re-exports§
Modules§
- codec
- Encoding/decoding for values stored in the
Store. - deque
- Local double-ended queue stored under a key.
- entry
- Internal entry types stored in the global key space.
- error
- Error type returned by heaplet operations.
- hash
- Hash map operations (field -> value) stored under a key.
- keys
- Key-space operations (lifecycle, TTL, renaming, and key enumeration).
- kv
- String / KV operations.
- list
- List operations with optional blocking pops.
- prelude
- Convenience re-exports for common heaplet types.
- set
- Unordered set operations stored under a key.
- store
- In-memory store and internal plumbing.
- zset
- Sorted set (zset) operations stored under a key.