Trait pyri_state::pattern::StatePattern
source · pub trait StatePattern<S: State>: 'static + Send + Sync + Sized {
// Required method
fn matches(&self, state: &S) -> bool;
// Provided methods
fn will_update(
self,
) -> impl 'static + Send + Sync + Fn(CurrentRef<'_, S>) -> bool { ... }
fn on_update<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs { ... }
fn will_exit(
self,
) -> impl 'static + Send + Sync + Fn(CurrentRef<'_, S>) -> bool { ... }
fn on_exit<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs { ... }
fn will_disable(
self,
) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool { ... }
fn on_disable<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs { ... }
fn will_enter(
self,
) -> impl 'static + Send + Sync + Fn(NextRef<'_, '_, S>) -> bool { ... }
fn on_enter<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs { ... }
fn will_enable(
self,
) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool { ... }
fn on_enable<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs { ... }
}Expand description
A type that can match a subset of values of the State type S.
If S implements Eq, it can be used directly as a state pattern.
See the following extension traits with additional bounds on Self and S:
Required Methods§
Provided Methods§
sourcefn will_update(
self,
) -> impl 'static + Send + Sync + Fn(CurrentRef<'_, S>) -> bool
fn will_update( self, ) -> impl 'static + Send + Sync + Fn(CurrentRef<'_, S>) -> bool
Build a run condition that checks if S is in a matching state.
sourcefn on_update<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
fn on_update<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
Configure systems to run if S is in a matching state.
sourcefn will_exit(self) -> impl 'static + Send + Sync + Fn(CurrentRef<'_, S>) -> bool
fn will_exit(self) -> impl 'static + Send + Sync + Fn(CurrentRef<'_, S>) -> bool
Build a run condition that checks if S will exit a matching state if triggered.
sourcefn on_exit<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
fn on_exit<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
Configure systems to run when S exits a matching state.
sourcefn will_disable(
self,
) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool
fn will_disable( self, ) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool
Build a run condition that checks if S will become disabled from a matching state if triggered.
sourcefn on_disable<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
fn on_disable<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
Configure systems to run when S is disabled from a matching state.
sourcefn will_enter(
self,
) -> impl 'static + Send + Sync + Fn(NextRef<'_, '_, S>) -> bool
fn will_enter( self, ) -> impl 'static + Send + Sync + Fn(NextRef<'_, '_, S>) -> bool
Build a run condition that checks if S will enter into a matching state if triggered.
sourcefn on_enter<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
fn on_enter<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
Configure systems to run when S enters a matching state.
sourcefn will_enable(
self,
) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool
fn will_enable( self, ) -> impl 'static + Send + Sync + Fn(FlushRef<'_, '_, S>) -> bool
Build a run condition that checks if S will become enabled in a matching state if triggered.
sourcefn on_enable<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
fn on_enable<M>(self, systems: impl IntoSystemConfigs<M>) -> SystemConfigs
Configure systems to run when S becomes enabled in a matching state.