Skip to main content

StateTransPattern

Trait StateTransPattern 

Source
pub trait StateTransPattern<S: State>:
    'static
    + Send
    + Sync
    + Sized {
    // Required method
    fn matches(&self, old: &S, new: &S) -> bool;

    // Provided methods
    fn will_trans(
        self,
    ) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool { ... }
    fn on_exit<M>(
        self,
        systems: impl IntoScheduleConfigs<ScheduleSystem, M>,
    ) -> ScheduleConfigs<ScheduleSystem> { ... }
    fn on_trans<M>(
        self,
        systems: impl IntoScheduleConfigs<ScheduleSystem, M>,
    ) -> ScheduleConfigs<ScheduleSystem> { ... }
    fn on_enter<M>(
        self,
        systems: impl IntoScheduleConfigs<ScheduleSystem, M>,
    ) -> ScheduleConfigs<ScheduleSystem> { ... }
}
Expand description

A type that can match a subset of transitions in the State type S.

A tuple of two StatePattern types can be used as a transition pattern.

See the following extension traits with additional bounds on Self:

Required Methods§

Source

fn matches(&self, old: &S, new: &S) -> bool

Check if the pattern matches a particular pair of states.

Provided Methods§

Source

fn will_trans( self, ) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool

Build a run condition that checks if S will undergo a matching transition if triggered.

Source

fn on_exit<M>( self, systems: impl IntoScheduleConfigs<ScheduleSystem, M>, ) -> ScheduleConfigs<ScheduleSystem>

Configure systems to run when S exits as part of a matching transition.

Source

fn on_trans<M>( self, systems: impl IntoScheduleConfigs<ScheduleSystem, M>, ) -> ScheduleConfigs<ScheduleSystem>

Configure systems to run when S undergoes a matching transition.

Source

fn on_enter<M>( self, systems: impl IntoScheduleConfigs<ScheduleSystem, M>, ) -> ScheduleConfigs<ScheduleSystem>

Configure systems to run when S enters as part of a matching transition.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<S: State, P1: StatePattern<S>, P2: StatePattern<S>> StateTransPattern<S> for (P1, P2)

Source§

fn matches(&self, old: &S, new: &S) -> bool

Implementors§

Source§

impl<S: State, F> StateTransPattern<S> for FnStateTransPattern<S, F>
where F: 'static + Send + Sync + Fn(&S, &S) -> bool,

Source§

impl<S: State> StateTransPattern<S> for AnyStateTransPattern<S>