gstore 0.0.2

Global state management for GTK applications
Documentation
# gstore

[![Pipeline status](https://gitlab.com/loers/gstore/badges/master/pipeline.svg)](https://gitlab.com/loers/gstore)
[![API](https://docs.rs/gstore/badge.svg)](https://docs.rs/gstore)

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<State> = Mutex::new(State { count: 0 });
}

fn main() {
    let mutex = Mutex::new(State { count: 0 });
    let store: Rc<Store<Action, State>> = Rc::new(Store::new(&STATE));
    let join = combine_reducers(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.");
    assert_eq!(STATE.lock().unwrap().count, 2);
}
```

## License

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