pub struct CompiledTriggers<Event: TriggerEvent> { /* private fields */ }
Expand description
A compiled collection of triggers.
This is the central type for using the event trigger action system.
Execute events via Self::execute_event
, Self::execute_events
and Self::execute_owned_events
, and collect actions via Self::consume_action
and Self::consume_all_actions
.
Implementations§
Source§impl<Event: TriggerEvent> CompiledTriggers<Event>
impl<Event: TriggerEvent> CompiledTriggers<Event>
Sourcepub fn execute_event(&mut self, event: &Event)
pub fn execute_event(&mut self, event: &Event)
Execute the given event.
The event is executed right away, and all resulting actions are stored in an internal action queue,
waiting to be retrieved via Self::consume_action
or Self::consume_all_actions
.
Sourcepub fn execute_events<'events>(
&mut self,
events: impl IntoIterator<Item = &'events Event>,
)where
Event: 'events,
pub fn execute_events<'events>(
&mut self,
events: impl IntoIterator<Item = &'events Event>,
)where
Event: 'events,
Execute the given events.
The event is executed right away, and all resulting actions are stored in an internal action queue,
waiting to be retrieved via Self::consume_action
or Self::consume_all_actions
.
Sourcepub fn execute_owned_events(&mut self, events: impl IntoIterator<Item = Event>)
pub fn execute_owned_events(&mut self, events: impl IntoIterator<Item = Event>)
Execute the given owned events.
The event is executed right away, and all resulting actions are stored in an internal action queue,
waiting to be retrieved via Self::consume_action
or Self::consume_all_actions
.
This method is no different from Self::execute_events
, except that it drops the given events after execution.
Sourcepub fn consume_action(&mut self) -> Option<Event::Action>
pub fn consume_action(&mut self) -> Option<Event::Action>
Consume an action from the action queue, if there is one.
Sourcepub fn consume_all_actions(
&mut self,
) -> impl '_ + Iterator<Item = Event::Action>
pub fn consume_all_actions( &mut self, ) -> impl '_ + Iterator<Item = Event::Action>
Consume all action from the action queue.
If the returned iterator is dropped before all actions are consumed, the remaining actions are dropped quietly.
Trait Implementations§
Source§impl<Event: Clone + TriggerEvent> Clone for CompiledTriggers<Event>
impl<Event: Clone + TriggerEvent> Clone for CompiledTriggers<Event>
Source§fn clone(&self) -> CompiledTriggers<Event>
fn clone(&self) -> CompiledTriggers<Event>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more