gstore

Pipeline status API

Global state management for GTK apps in redux style.

gstore implements a redux like store for global state management for GTK apps. Action handling is done in a background thread.

Usage

```rust

[macro_use]

extern crate lazy_static;

use std::rc::Rc; use std::sync::Mutex; use gstore::{ combine_reducers, Store };

[derive(Debug, Clone)]

struct State { count: u32, }

[derive(Debug, Clone, Eq, PartialEq)]

enum Action { Increment, Decrement, Shutdown, }

lazy_static! { static ref STATE: Mutex = Mutex::new(State { count: 0 }); }

fn main() { let mutex = Mutex::new(State { count: 0 }); let store: Rc> = Rc::new(Store::new(&STATE)); let join = combinereducers(store.clone(), &STATE, |action, state| match action { Action::Increment => Some(State { count: state.count + 1, }), Action::Decrement => Some(State { count: state.count - 1, }), Action::Shutdown => None, }); store.send(Action::Increment); store.send(Action::Increment); store.send(Action::Increment); store.send(Action::Decrement); store.send(Action::Shutdown); join.join().unwrap().expect("Error during Store handling."); asserteq!(STATE.lock().unwrap().count, 2); } ```

License

gstore is distributed under the terms of the MIT license. See LICENSE for details.