pub struct AnyAction { /* private fields */ }Expand description
Erased Action<Intent>: one identity and a static vtable, the fat pointer rustc cannot
build for an arena id.
This is what a field or parameter Dart types as Action<Intent> becomes; the leaf stays in
the App under its own type, and downcast gets the typed handle back.
Equality is Dart’s == on an object reference: two handles are equal exactly when they
address the same action.
Implementations§
Source§impl AnyAction
impl AnyAction
Source§impl AnyAction
impl AnyAction
Sourcepub fn to_string_short(self) -> String
pub fn to_string_short(self) -> String
Dart’s Action.toStringShort: the type and the identity.
Sourcepub fn debug_fill_properties(
self,
app: &App,
properties: &mut DiagnosticPropertiesBuilder,
)
pub fn debug_fill_properties( self, app: &App, properties: &mut DiagnosticPropertiesBuilder, )
Dart’s action.debugFillProperties.
Sourcepub fn of<L: Action>(action: Handle<L>) -> AnyAction
pub fn of<L: Action>(action: Handle<L>) -> AnyAction
The type-erased handle of a plain Action leaf; Action::as_action calls this.
Sourcepub fn of_context<L: ContextAction>(action: Handle<L>) -> AnyAction
pub fn of_context<L: ContextAction>(action: Handle<L>) -> AnyAction
The type-erased handle of a ContextAction leaf;
context_action_overrides! calls this.
Sourcepub fn overridable(
app: &mut App,
default_action: ActionRef,
context: BuildContext,
) -> ActionRef
pub fn overridable( app: &mut App, default_action: ActionRef, context: BuildContext, ) -> ActionRef
Creates an Action that allows itself to be overridden by the closest ancestor
Action in the given context that handles the same Intent, if one exists.
When invoked, the resulting Action tries to find the closest Action in the given
context that handles the same type of Intent as the default_action, then calls
its invoke method. When no override Actions can be found, it
invokes the default_action.
An overridable action delegates everything to its override if one exists, and has the
same behavior as its default_action otherwise. For this reason, the override has full
control over whether and how an Intent should be handled, or a key event should be
consumed. An override Action’s Action::calling_action property will be set to
the Action it currently overrides, giving it access to the default behavior.
The context argument is the BuildContext to find the override with. It is
typically a BuildContext above the Actions widget that contains this overridable
Action.
The default_action argument is the Action to be invoked where no ancestor
Actions can be found in context that handle the same type of Intent.
Dart’s Action.overridable.
Sourcepub fn downcast<T: 'static>(self, app: &App) -> Option<Handle<T>>
pub fn downcast<T: 'static>(self, app: &App) -> Option<Handle<T>>
Dart’s action as T: the typed handle when this action is a T, else None.
Sourcepub fn intent_type(self) -> TypeId
pub fn intent_type(self) -> TypeId
See Action::intent_type.
Sourcepub fn calling_action(self, app: &App) -> Option<AnyAction>
pub fn calling_action(self, app: &App) -> Option<AnyAction>
Sourcepub fn update_calling_action(self, app: &mut App, value: Option<ActionRef>)
pub fn update_calling_action(self, app: &mut App, value: Option<ActionRef>)
Sourcepub fn is_enabled(
self,
app: &mut App,
intent: &dyn Intent,
context: Option<BuildContext>,
) -> bool
pub fn is_enabled( self, app: &mut App, intent: &dyn Intent, context: Option<BuildContext>, ) -> bool
Dart’s Action._isEnabled: ContextAction::is_enabled when the action is a
ContextAction, Action::is_enabled otherwise.
Sourcepub fn is_action_enabled(self, app: &mut App) -> bool
pub fn is_action_enabled(self, app: &mut App) -> bool
Sourcepub fn consumes_key(self, app: &mut App, intent: &dyn Intent) -> bool
pub fn consumes_key(self, app: &mut App, intent: &dyn Intent) -> bool
See Action::consumes_key.
Sourcepub fn to_key_event_result(
self,
app: &mut App,
intent: &dyn Intent,
invoke_result: Option<&Rc<dyn Any>>,
) -> KeyEventResult
pub fn to_key_event_result( self, app: &mut App, intent: &dyn Intent, invoke_result: Option<&Rc<dyn Any>>, ) -> KeyEventResult
Sourcepub fn invoke(
self,
app: &mut App,
intent: &dyn Intent,
context: Option<BuildContext>,
) -> Option<Rc<dyn Any>>
pub fn invoke( self, app: &mut App, intent: &dyn Intent, context: Option<BuildContext>, ) -> Option<Rc<dyn Any>>
Dart’s Action._invoke: ContextAction::invoke when the action is a
ContextAction, Action::invoke otherwise.
Sourcepub fn add_action_listener(
self,
app: &mut App,
listener: ActionListenerCallback,
)
pub fn add_action_listener( self, app: &mut App, listener: ActionListenerCallback, )
Sourcepub fn remove_action_listener(
self,
app: &mut App,
listener: &ActionListenerCallback,
)
pub fn remove_action_listener( self, app: &mut App, listener: &ActionListenerCallback, )
Sourcepub fn notify_action_listeners(self, app: &mut App)
pub fn notify_action_listeners(self, app: &mut App)
Trait Implementations§
impl Copy for AnyAction
impl Eq for AnyAction
Auto Trait Implementations§
impl Forget for AnyAction
impl Freeze for AnyAction
impl Move for AnyAction
impl RefUnwindSafe for AnyAction
impl Send for AnyAction
impl Sync for AnyAction
impl Unpin for AnyAction
impl UnsafeUnpin for AnyActionwhere
NonZeroU32Inner: UnsafeUnpin,
&'static ActionVTable: UnsafeUnpin,
impl UnwindSafe for AnyAction
Blanket Implementations§
Source§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.