pub struct Action { /* private fields */ }
Expand description
An Action describes a mutation of the global state.
It has a name which is used for pattern matching and a payload. Since gstore is for the GTK framework these actions are linked to GTK Actions. GTK Actions use their own ‘generic value type’ called Variant. Thus gstore Actions have a Variant as argument.
Examples
ⓘ
// given we receive an action `action` in a reducer
// Note: Action::new is not public
let action = Action::new("test".into(), Some(128_i32.to_variant()))
// get a rust value from it by using
if let Some(number) = action.arg::<i32>() {
// do stuff
}
Implementations
Create a new action.
NOTE:
This is a placeholder since rustdoc server can not compile latest gtk yet The actual signature looks like this:
pub fn argument(&self) -> Option<&glib::Variant>
Try to get the argument as
NOTE:
This is a placeholder since rustdoc server can not compile latest gtk yet The actual signature looks like this:
pub fn arg<T: glib::FromVariant + Sized>(&self) -> Option<T>
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Action
impl UnwindSafe for Action
Blanket Implementations
Mutably borrows from an owned value. Read more