add with_enter_stage (and other variants) (#1091)
This commit is contained in:
parent
9db38b7b97
commit
caf3d8b3ef
@ -33,6 +33,21 @@ impl<T> Default for StateStage<T> {
|
|||||||
|
|
||||||
#[allow(clippy::mem_discriminant_non_enum)]
|
#[allow(clippy::mem_discriminant_non_enum)]
|
||||||
impl<T> StateStage<T> {
|
impl<T> StateStage<T> {
|
||||||
|
pub fn with_enter_stage<S: Stage>(mut self, state: T, stage: S) -> Self {
|
||||||
|
self.set_enter_stage(state, stage);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_exit_stage<S: Stage>(mut self, state: T, stage: S) -> Self {
|
||||||
|
self.set_exit_stage(state, stage);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn with_update_stage<S: Stage>(mut self, state: T, stage: S) -> Self {
|
||||||
|
self.set_update_stage(state, stage);
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn set_enter_stage<S: Stage>(&mut self, state: T, stage: S) -> &mut Self {
|
pub fn set_enter_stage<S: Stage>(&mut self, state: T, stage: S) -> &mut Self {
|
||||||
let stages = self.state_stages(state);
|
let stages = self.state_stages(state);
|
||||||
stages.enter = Box::new(stage);
|
stages.enter = Box::new(stage);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user