pub enum SessionState {
Created,
Active,
Idle,
Terminated,
}Expand description
Represents the lifecycle state of a shell session.
Variants§
Created
Session has been created but not yet activated.
Active
Session is actively processing commands.
Idle
Session is idle, waiting for commands.
Terminated
Session has been terminated and cannot be reused.
Implementations§
Source§impl SessionState
impl SessionState
Sourcepub fn can_transition_to(&self, target: SessionState) -> bool
pub fn can_transition_to(&self, target: SessionState) -> bool
Check if transition to target state is valid.
Valid transitions:
- Created -> Active
- Created -> Idle (session created and immediately ready for commands)
- Active -> Idle
- Active -> Terminated
- Idle -> Active
- Idle -> Terminated
Note: Created -> Idle exists because a freshly created session holds no
persistent PTY (each command spawns its own), so it is ready to accept
commands the moment it is created. This keeps the create→execute flow
working out-of-the-box without the consumer having to drive an explicit
activation step (thin-API principle).
Sourcepub fn transition_to(&mut self, target: SessionState) -> Result<()>
pub fn transition_to(&mut self, target: SessionState) -> Result<()>
Attempt to transition to a new state.
Returns Ok(()) if the transition is valid, or an error otherwise.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this is a terminal state (no further transitions possible).
Sourcepub fn can_execute(&self) -> bool
pub fn can_execute(&self) -> bool
Check if session can accept commands.
Trait Implementations§
Source§impl Clone for SessionState
impl Clone for SessionState
Source§fn clone(&self) -> SessionState
fn clone(&self) -> SessionState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SessionState
Source§impl Debug for SessionState
impl Debug for SessionState
Source§impl Default for SessionState
impl Default for SessionState
Source§fn default() -> SessionState
fn default() -> SessionState
impl Eq for SessionState
Source§impl PartialEq for SessionState
impl PartialEq for SessionState
impl StructuralPartialEq for SessionState
Auto Trait Implementations§
impl Freeze for SessionState
impl RefUnwindSafe for SessionState
impl Send for SessionState
impl Sync for SessionState
impl Unpin for SessionState
impl UnsafeUnpin for SessionState
impl UnwindSafe for SessionState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.