rs-store
A thread-safe Redux-style state management library implemented in Rust.
Overview
rs-store provides a predictable state container inspired by Redux, featuring thread-safe state management with support for reducers, subscribers, and async actions through Thunk. Unlike traditional Redux, rs-store's reducers can produce side effects, providing more flexibility in state management.
Features
- ๐ Thread-safe state management
- ๐ข Publisher/Subscriber pattern for state changes
- ๐ Support for asynchronous operations via Thunk actions
- ๐ Side effect handling in reducers
- ๐ Middleware handles actions and effects
- ๐ Backpressure handling with configurable policies
- ๐ฏ Bounded channel size with sync channels
- ๐งช Comprehensive test coverage
- ๐ Selector support
- ๐ Metrics support
Installation
Add this to your Cargo.toml:
[]
= "0.18.0"
Quick Start
use ;
use ;
Side Effects in Reducers
Unlike traditional Redux implementations, rs-store allows reducers to produce side effects directly. This means reducers can produce asynchronous operations.
This design choice provides more flexibility while maintaining predictable state management.
Documentation
For detailed documentation, visit:
Implementation Status
In Progress ๐ง
- Latest state notification for new subscribers
- Notification scheduler (CurrentThread, ThreadPool)
- Stream-based pull model
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.