Skip to content

Commit

Permalink
impl Deref for State<S>
Browse files Browse the repository at this point in the history
  • Loading branch information
Aceeri committed Mar 23, 2023
1 parent 4f16d6e commit e258de8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/bevy_ecs/src/schedule/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ pub struct OnUpdate<S: States>(pub S);
#[derive(Resource, Default, Debug)]
pub struct State<S: States>(pub S);

impl<S: States> std::ops::Deref for State<S> {
type Target = S;
fn deref(&self) -> &Self::Target {
&self.0
}
}

/// The next state of [`State<S>`].
///
/// To queue a transition, just set the contained value to `Some(next_state)`.
Expand Down

0 comments on commit e258de8

Please sign in to comment.