statia 0.1.2

A Universal and Lightweight, Zero dependency Rust state management library.
Documentation
  • Coverage
  • 0%
    0 out of 15 items documented0 out of 14 items with examples
  • Size
  • Source code size: 42.25 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 262.64 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • VoltagedDebunked

Statia

Zero-dependency state management for Rust applications. Thread-safe, type-safe, and built entirely on stdlib.

Features

  • Thread-safe state containers using RwLock
  • Pub/sub system for state changes
  • Transaction support for atomic updates
  • Type-safe state registry
  • Pure stdlib - no external dependencies

Usage

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();

Installation

Add to Cargo.toml:

[dependencies]
statia = "0.1.0"

License

GPL-3.0

Contributing

Pull requests welcome! Please read CONTRIBUTING.md first.