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
sourceimpl Action
impl Action
sourcepub fn argument(&self) -> Option<String>
pub fn argument(&self) -> Option<String>
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>
sourcepub fn arg<T: Sized>(&self) -> Option<String>
pub fn arg<T: Sized>(&self) -> Option<String>
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 Send for Action
impl Sync for Action
impl Unpin for Action
impl UnwindSafe for Action
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more