1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! # 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
//!
//! ```rust
//! 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).
pub use crateError;
pub use crateStore;