Trait ThreadLifecycle
pub trait ThreadLifecycle: Send + Sync {
// Required methods
fn state(&self) -> ThreadState;
fn transition(&mut self, new_state: ThreadState) -> Result<(), NerveError>;
fn can_transition_to(&self, target_state: ThreadState) -> bool;
fn time_in_current_state(&self) -> Duration;
fn lifetime(&self) -> Duration;
}Expand description
Thread lifecycle management interface
Required Methods§
fn state(&self) -> ThreadState
fn state(&self) -> ThreadState
Get current thread state
fn transition(&mut self, new_state: ThreadState) -> Result<(), NerveError>
fn transition(&mut self, new_state: ThreadState) -> Result<(), NerveError>
Transition to a new state
fn can_transition_to(&self, target_state: ThreadState) -> bool
fn can_transition_to(&self, target_state: ThreadState) -> bool
Check if transition to target state is valid
fn time_in_current_state(&self) -> Duration
fn time_in_current_state(&self) -> Duration
Get time spent in current state