Skip to content

Commit

Permalink
add with_enter_stage (and other variants) (bevyengine#1091)
Browse files Browse the repository at this point in the history
  • Loading branch information
cart authored Dec 19, 2020
1 parent 9db38b7 commit caf3d8b
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions crates/bevy_ecs/src/schedule/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ impl<T> Default for StateStage<T> {

#[allow(clippy::mem_discriminant_non_enum)]
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 {
let stages = self.state_stages(state);
stages.enter = Box::new(stage);
Expand Down

0 comments on commit caf3d8b

Please sign in to comment.