7 releases (breaking)

new 0.6.0 Jun 10, 2024
0.5.2 May 31, 2024
0.4.1 Apr 17, 2024
0.3.1 Apr 12, 2024
0.1.0 Apr 11, 2024

#5 in #redux

Download history 482/week @ 2024-04-11 81/week @ 2024-04-18 5/week @ 2024-04-25 1/week @ 2024-05-02 147/week @ 2024-05-09 12/week @ 2024-05-16 12/week @ 2024-05-23 194/week @ 2024-05-30 142/week @ 2024-06-06

362 downloads per month

Custom license

22KB
594 lines

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

To Do

  • add subscription to unsubscribe
  • add thread name
  • add Middleware
  • add Thunk
  • Add tests

Dependencies

~315–800KB
~18K SLoC