Struct CompiledTriggers

Source
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>

Source

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.

Source

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.

Source

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.

Source

pub fn consume_action(&mut self) -> Option<Event::Action>

Consume an action from the action queue, if there is one.

Source

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.

Source

pub fn progress(&self, handle: TriggerHandle) -> Option<(f64, f64)>

Returns the progress of the given trigger as (current_progress, required_progress).

When current_progress reaches required_progress, then the trigger triggers.

Trait Implementations§

Source§

impl<Event: Clone + TriggerEvent> Clone for CompiledTriggers<Event>
where Event::Action: Clone,

Source§

fn clone(&self) -> CompiledTriggers<Event>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<Event: Debug + TriggerEvent> Debug for CompiledTriggers<Event>
where Event::Action: Debug,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Event> Freeze for CompiledTriggers<Event>

§

impl<Event> RefUnwindSafe for CompiledTriggers<Event>

§

impl<Event> Send for CompiledTriggers<Event>
where <Event as TriggerEvent>::Action: Send, <Event as TriggerEvent>::Identifier: Send, Event: Send,

§

impl<Event> Sync for CompiledTriggers<Event>
where <Event as TriggerEvent>::Action: Sync, <Event as TriggerEvent>::Identifier: Sync, Event: Sync,

§

impl<Event> Unpin for CompiledTriggers<Event>
where <Event as TriggerEvent>::Action: Unpin, <Event as TriggerEvent>::Identifier: Unpin, Event: Unpin,

§

impl<Event> UnwindSafe for CompiledTriggers<Event>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

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

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.
Source§

impl<T> ConditionalSerde for T