rs-store

Crates.iors-store
lib.rsrs-store
version0.9.0
sourcesrc
created_at2024-04-11 09:58:16.185475
updated_at2024-07-03 15:29:51.337444
descriptionRedux Store for Rust
homepage
repositoryhttps://github.com/rookiecj/rs-store
max_upload_size
id1204668
size36,111
Changju Lee (rookiecj)

documentation

README

rs-store

rs-store is a Redux Store written in Rust.

Key Features

Manage and receive notifications of state changes through the Reducer and Subscriber interfaces. Store registers Reducer and Subscriber, dispatches actions to change the state, and sends notifications. Store is designed to be thread-safe, enabling parallel processing.

How to use


pub fn main() {
    println!("Hello, Calc!");

    let store = Store::<CalcState, CalcAction>::new(Box::new(CalcReducer::default()));

    store.add_subscriber(Arc::new(CalcSubscriber::default()));
    store.dispatch(CalcAction::Add(1));

    thread::sleep(std::time::Duration::from_secs(1));
    store.add_subscriber(Arc::new(CalcSubscriber::default()));
    store.dispatch(CalcAction::Subtract(1));

    store.stop();
}

Features

  • add thread name
  • subscription to unsubscribe
  • clear subscribers (clear_subscribers)
  • add Thunk action(dispatch_thunk)
  • Add tests
Commit count: 40

cargo fmt