fn switch(&mut self, state: Box<State<T>>, data: StateData<T>) {
        if self.running {
            let StateData { world, data } = data;
            if let Some(mut state) = self.state_stack.pop() {
                state.on_stop(StateData { world, data });
            }

            self.state_stack.push(state);
            let state = self.state_stack.last_mut().unwrap();
            state.on_start(StateData { world, data });
        }
    }
/// Removes the current state on the stack and inserts a different one.
Removes the current state on the stack and inserts a different one.
Removes the current state on the stack and inserts a different one .
fn switch(&mut self, state: Box<State<T>>, data: StateData<T>) {
        if self.running {
            let StateData { world, data } = data;
            if let Some(mut state) = self.state_stack.pop() {
                state.on_stop(StateData { world, data });
            }
            self.state_stack.push(state);
            let state = self.state_stack.last_mut().unwrap();
            state.on_start(StateData { world, data });
        }
    }
fn switch ( & mut self , state : Box < State < T > > , data : StateData < T > ) { if self . running { let StateData { world , data } = data ; if let Some ( mut state ) = self . state_stack . pop ( ) { state . on_stop ( StateData { world , data } ) ; } self . state_stack . push ( state ) ; let state = self . state_stack . last_mut ( ) . unwrap ( ) ; state . on_start ( StateData { world , data } ) ; } }
Removes the current state on the stack and inserts a different one.
Removes the current state on the stack and inserts a different one .
&mut self
state
Box<State<T>>
data
StateData<T>
&mut self
state
Box<State<T>>
data
StateData<T>