Skip to main content

Action

Struct Action 

Source
pub struct Action {
    pub intent: &'static str,
    pub handler: ActionHandler,
    pub enabled_when: Option<Prop<bool>>,
}
Expand description

A widget-owned handler bound to a named intent.

Fields§

§intent: &'static str

The intent name this action responds to. Matches against Intent::name during dispatch.

§handler: ActionHandler

Invoked when a matching intent is dispatched to this widget.

§enabled_when: Option<Prop<bool>>

Reactive “is this action currently applicable?” predicate. None means always enabled.

Disabled semantics at dispatch time: the intent propagates past this action as if no match existed here, unless the firing Shortcut has propagate_when_disabled == false, in which case the intent is consumed (dormant) at this level.

Implementations§

Source§

impl Action

Source

pub fn new(intent: &'static str) -> ActionBuilder

Start building an Action bound to the given intent name.

Source

pub fn is_enabled(&self) -> bool

Resolve the current enabled state. true when no predicate is set; otherwise reads the signal.

Trait Implementations§

Source§

impl Debug for Action

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Action

§

impl !Send for Action

§

impl !Sync for Action

§

impl !UnwindSafe for Action

§

impl Freeze for Action

§

impl Unpin for Action

§

impl UnsafeUnpin for Action

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.