amethystate
A state manager for Rust applications.
amethystate is a state manager for Rust applications: state is declared as an ordinary struct, its fields are
reactive, and they outlive the program.
Features
- Struct-defined state — one attribute turns a struct's fields into persisted reactive ones, with defaults, subscriptions, and interceptors that can refuse a write
- Runtime-defined keys — a map entry or a
Kvpath gets the same subscriptions, interceptors and durability as a declared field - Read and write every frame — writes are buffered and batched, reads answer from memory
- Durable when it matters —
durable()on a field, a map or aKvpath returns only once the value is on disk, for the writes that must not sit in a buffer - Behaviour you choose — which engine holds the state, when a write reaches the disk, what a field does with a value that will not read, what a new version does to an old file
- Migrations — explicit versions, run at startup; drift is logged
- Three backends, five formats —
redb,sqlite, and text asjson/toml/ron; text files reload on external edits - Integrations — Tauri (+TS bindings), Leptos, Dioxus, Yew, GPUI, windows-reactor, egui/iced/ratatui
- Tracing — structured events, each write tagged with its source struct
use ;
See the book for full documentation — concepts, migrations, and per-framework integration guides.
Compatibility
The minimum supported Rust version (MSRV) for amethystate is 1.90.