pub enum Action {
Create(Tree<Element>, CreateOrder),
ModifyController(Box<dyn FnOnce(&mut Controller)>),
ModifyModel(Box<dyn FnOnce(&mut Model)>),
ModifyView(Box<dyn FnOnce(&mut View)>),
SubmitCallback(CallbackId),
Focus,
Enable,
Disable,
Destroy,
ReleaseButtons,
}
Expand description
An interface-level event
Variants§
Create(Tree<Element>, CreateOrder)
ModifyController(Box<dyn FnOnce(&mut Controller)>)
ModifyModel(Box<dyn FnOnce(&mut Model)>)
ModifyView(Box<dyn FnOnce(&mut View)>)
SubmitCallback(CallbackId)
This will submit produce an event with the Model containing this callback ID, but will not modify the current Model callback ID.
See the Form widget control FormSubmitCallback
for a control function
that submits a model with the currently set callback ID.
Focus
Change the view state from Enabled to Focused; it is a debug error if the view state is not Enabled.
If top
is true, node will be moved to the last sibling position
(“top”), otherwise position relative to siblings will remain unchanged
Enable
Change view.state
from Disabled to Enabled; it is a debug error if the
view state is not Disabled
Disable
Change the view.state
from Enabled to Disabled; it is a debug error if
the view state is not Enabled
Destroy
Destroy the target element and children.
If the node was focused, then focus is shifted to the parent. If it was the root node that was focused, then this is always an error since the root node is always focused as the common ancestor of all nodes.
ReleaseButtons
Trigger any release buttons that exist in the current input map of the controller of the target node.
This can be used when focus is changing and input state should not be orphaned.
Implementations§
Source§impl Action
impl Action
Sourcepub fn create_singleton(element: Element, order: CreateOrder) -> Self
pub fn create_singleton(element: Element, order: CreateOrder) -> Self
Produces a Create action that creates a singleton subtree containing the given Element
Sourcepub fn set_view(view: View) -> Self
pub fn set_view(view: View) -> Self
Produces a ModifyView action that sets the given View data.
Sourcepub fn set_controller(controller: Controller) -> Self
pub fn set_controller(controller: Controller) -> Self
Produces a ModifyController action that sets the given Controller data.
Sourcepub fn set_model(model: Model) -> Self
pub fn set_model(model: Model) -> Self
Produces a ModifyModel action that sets the given Model data.
Sourcepub fn set_view_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
pub fn set_view_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
Produces a ModifyView action that sets the given component Kind
Sourcepub fn update_view_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
pub fn update_view_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
Produces a ModifyView action that updates the current component with the given value and panics if the current component is not the same Kind
Sourcepub fn set_controller_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
pub fn set_controller_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
Produces a ModifyController action that sets the given component Kind
Sourcepub fn update_controller_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
pub fn update_controller_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
Produces a ModifyController action that updates the current component with the given value and panics if the current component is not the same Kind
Sourcepub fn set_model_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
pub fn set_model_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
Produces a ModifyModel action that sets the given component Kind
Sourcepub fn update_model_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
pub fn update_model_component<V>(component: V) -> Selfwhere
V: Kind + 'static,
Produces a ModifyModel action that updates the current component with the given value and panics if the current component is not the same Kind
Trait Implementations§
Source§impl From<CallbackId> for Action
impl From<CallbackId> for Action
Source§fn from(value: CallbackId) -> Self
fn from(value: CallbackId) -> Self
Auto Trait Implementations§
impl Freeze for Action
impl !RefUnwindSafe for Action
impl !Send for Action
impl !Sync for Action
impl Unpin for Action
impl !UnwindSafe for Action
Blanket Implementations§
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more