Skip to content

Commit edb711f

Browse files
committed
Added public & fixed formatting
1 parent 48d6083 commit edb711f

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

crates/bevy_state/src/app.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ use log::warn;
55

66
use crate::{
77
state::{
8-
setup_state_transitions_in_world, ComputedStates, FreelyMutableState, NextState, PreviousState, State,
9-
StateTransition, StateTransitionEvent, StateTransitionSystems, States, SubStates,
8+
setup_state_transitions_in_world, ComputedStates, FreelyMutableState, NextState,
9+
PreviousState, State, StateTransition, StateTransitionEvent, StateTransitionSystems,
10+
States, SubStates,
1011
},
1112
state_scoped::{despawn_entities_on_enter_state, despawn_entities_on_exit_state},
1213
};

crates/bevy_state/src/state/resources.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ impl<S: States> Deref for State<S> {
133133
)]
134134
pub struct PreviousState<S: States>(pub(crate) S);
135135

136+
impl<S: States> PreviousState<S> {
137+
/// Get the previous state.
138+
pub fn get(&self) -> &S {
139+
&self.0
140+
}
141+
}
142+
136143
impl<S: States> Deref for PreviousState<S> {
137144
type Target = S;
138145

crates/bevy_state/src/state/transitions.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ use bevy_ecs::{
77
world::World,
88
};
99

10-
use super::{resources::{PreviousState, State},states::States};
10+
use super::{
11+
resources::{PreviousState, State},
12+
states::States,
13+
};
1114

1215
/// The label of a [`Schedule`] that **only** runs whenever [`State<S>`] enters the provided state.
1316
///

0 commit comments

Comments
 (0)