Struct relm4::actions::RelmAction

source ·
pub struct RelmAction<Name: ActionName> { /* private fields */ }
Expand description

A type safe action that wraps around gio::SimpleAction.

Implementations§

source§

impl<Name: ActionName> RelmAction<Name>where Name::State: ToVariant + FromVariant, Name::Target: ToVariant + FromVariant,

source

pub fn new_stateful_with_target_value<Callback: Fn(&SimpleAction, &mut Name::State, Name::Target) + 'static>( start_value: &Name::State, callback: Callback ) -> Self

Create a new stateful action with target value.

source§

impl<Name: ActionName> RelmAction<Name>where Name::State: ToVariant + FromVariant, Name::Target: EmptyType,

source

pub fn new_stateful<Callback: Fn(&SimpleAction, &mut Name::State) + 'static>( start_value: &Name::State, callback: Callback ) -> Self

Create a new stateful action.

source§

impl<Name: ActionName> RelmAction<Name>where Name::State: EmptyType, Name::Target: ToVariant + FromVariant,

source

pub fn new_with_target_value<Callback: Fn(&SimpleAction, Name::Target) + 'static>( callback: Callback ) -> Self

Create a new stateless action with a target value.

source§

impl<Name: ActionName> RelmAction<Name>where Name::Target: EmptyType, Name::State: EmptyType,

source

pub fn new_stateless<Callback: Fn(&SimpleAction) + 'static>( callback: Callback ) -> Self

Create a new stateless action.

source§

impl<Name: ActionName> RelmAction<Name>where Name::Target: ToVariant + FromVariant,

source

pub fn to_menu_item_with_target_value( label: &str, target_value: &Name::Target ) -> MenuItem

Create a menu item for this action with the target value sent to the action on activation.

source§

impl<Name: ActionName> RelmAction<Name>where Name::Target: EmptyType,

source

pub fn to_menu_item(label: &str) -> MenuItem

Create a menu item for this action.

Trait Implementations§

source§

impl<Name: Debug + ActionName> Debug for RelmAction<Name>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Name> RefUnwindSafe for RelmAction<Name>where Name: RefUnwindSafe,

§

impl<Name> !Send for RelmAction<Name>

§

impl<Name> !Sync for RelmAction<Name>

§

impl<Name> Unpin for RelmAction<Name>where Name: Unpin,

§

impl<Name> UnwindSafe for RelmAction<Name>where Name: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.