pub fn replace(&mut self, state: T) -> Result<(), StateError> {
        if self.stack.last().unwrap() == &state {
            return Err(StateError::AlreadyInState);
        }

        if self.scheduled.is_some() {
            return Err(StateError::StateAlreadyQueued);
        }

        self.scheduled = Some(ScheduledOperation::Replace(state));
        Ok(())
    }
/// Schedule a state change that replaces the full stack with the given state.
/// This will fail if there is a scheduled operation, or if the given `state` matches the
/// current state
Schedule a state change that replaces the full stack with the given state.
This will fail if there is a scheduled operation, or if the given `state` matches the
current state
Schedule a state change that replaces the full stack with the given state . This will fail if there is a scheduled operation or if the given ` state ` matches the current state
pub fn replace(&mut self, state: T) -> Result<(), StateError> {
        if self.stack.last().unwrap() == &state {
            return Err(StateError::AlreadyInState);
        }
        if self.scheduled.is_some() {
            return Err(StateError::StateAlreadyQueued);
        }
        self.scheduled = Some(ScheduledOperation::Replace(state));
        Ok(())
    }
pub fn replace ( & mut self , state : T ) -> Result < ( ) , StateError > { if self . stack . last ( ) . unwrap ( ) == & state { return Err ( StateError :: AlreadyInState ) ; } if self . scheduled . is_some ( ) { return Err ( StateError :: StateAlreadyQueued ) ; } self . scheduled = Some ( ScheduledOperation :: Replace ( state ) ) ; Ok ( ( ) ) }
Schedule a state change that replaces the full stack with the given state.
Schedule a state change that replaces the full stack with the given state .
&mut self
state
T
&mut self
state
T