pub enum TaskState {
Runnable(TaskIntent),
InSend {
task_id: String,
},
InReply {
task_id: String,
},
Completed(HarnessOutcome),
Faulted(Fault),
}Expand description
State machine for task lifecycle.
Valid transitions:
- Runnable -> InSend
- InSend -> InReply
- InReply -> Completed | Faulted
- Any non-terminal -> Faulted
Variants§
Implementations§
Source§impl TaskState
impl TaskState
pub fn task_id(&self) -> Option<&str>
pub fn is_terminal(&self) -> bool
pub fn transition_to_in_send(self) -> Result<Self, String>
pub fn transition_to_in_reply(self) -> Result<Self, String>
pub fn transition_to_completed( self, outcome: HarnessOutcome, ) -> Result<Self, String>
pub fn transition_to_faulted(self, fault: Fault) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TaskState
impl<'de> Deserialize<'de> for TaskState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for TaskState
Auto Trait Implementations§
impl Freeze for TaskState
impl RefUnwindSafe for TaskState
impl Send for TaskState
impl Sync for TaskState
impl Unpin for TaskState
impl UnsafeUnpin for TaskState
impl UnwindSafe for TaskState
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
Mutably borrows from an owned value. Read more