gstore 0.5.1

Global and local state management in redux style for GTK applications written in Rust
docs.rs failed to build gstore-0.5.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: gstore-0.7.0

gstore

pipeline status API

Global and local state management for GTK apps which implements the flux pattern. This crate targets apps written with gtk-rust-app framework.

A State can be any kind of data structure an application is based on. For a 'counter' app it might be a struct with a single u32 field. Actions are enums which represent the possible features of the app affecting the state.

Global store usage


// Given you have a global state
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct State {
    pub numbers: Vec<u128>
}

// Using the store macro a 'store' for this state
store!(State);
// The following public interface will be generated:

// pub type Store = gstore::Store<State>

/// Initialize the store and global state
/// 
/// # Arguments
/// - initializer: Initialize the state.
/// - reducer: Handle actions and mutate the state
/// - middlewares: Pre- and post-reduce handlers
// pub fn init_store(
//     initializer: impl Fn(&mut State), 
//     reducer: impl Fn(gstore::Action, &mut State), 
//     middleware: Vec<Box<dyn gstore::Middleware<State>>>
// )

/// Get a static reference to the store
// pub fn store() -> &'static Store


Performance data

gstore can print basic performance information via the environment variabl GSTORE_PERF=1;

License

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