| Crates.io | statia |
| lib.rs | statia |
| version | 0.1.2 |
| created_at | 2025-01-26 15:25:51.899672+00 |
| updated_at | 2025-01-26 18:37:54.024804+00 |
| description | A Universal and Lightweight, Zero dependency Rust state management library. |
| homepage | https://statia.dev |
| repository | https://github.com/voltageddebunked/statia |
| max_upload_size | |
| id | 1531448 |
| size | 42,250 |
Zero-dependency state management for Rust applications. Thread-safe, type-safe, and built entirely on stdlib.
use statia::{State, StateManager};
// Single state
let counter = State::new(0);
counter.set(42);
assert_eq!(counter.get(), 42);
// Subscribe to changes
counter.subscribe(|value| println!("Counter changed to: {}", value));
// Multiple states
let manager = StateManager::new();
let count_state = manager.register("count", 0);
let name_state = manager.register("name", String::from("test"));
// Transactions
let mut transaction = Transaction::new(counter);
transaction.update(|v| *v += 1);
transaction.update(|v| *v *= 2);
transaction.commit();
Add to Cargo.toml:
[dependencies]
statia = "0.1.0"
GPL-3.0
Pull requests welcome! Please read CONTRIBUTING.md first.