pub struct TaskStatus {
pub state: TaskState,
pub message: Option<Message>,
pub timestamp: Option<String>,
}Expand description
The current status of a Task, combining state with an optional message
and timestamp.
Fields§
§state: TaskStateCurrent lifecycle state.
message: Option<Message>Optional agent message accompanying this status (e.g. error details).
timestamp: Option<String>ISO 8601 timestamp of when this status was set.
Implementations§
Source§impl TaskStatus
impl TaskStatus
Sourcepub const fn new(state: TaskState) -> Self
pub const fn new(state: TaskState) -> Self
Creates a TaskStatus with just a state and no timestamp.
Prefer TaskStatus::with_timestamp in production code so that
status changes carry an ISO 8601 timestamp.
Sourcepub fn with_timestamp(state: TaskState) -> Self
pub fn with_timestamp(state: TaskState) -> Self
Creates a TaskStatus with a state and the current UTC timestamp.
Sourcepub fn has_valid_timestamp(&self) -> bool
pub fn has_valid_timestamp(&self) -> bool
Validates the timestamp field if present.
Returns true if the timestamp is absent or is a valid ISO 8601
formatted string. Returns false if the timestamp is present but
does not match the expected format.
Trait Implementations§
Source§impl Clone for TaskStatus
impl Clone for TaskStatus
Source§fn clone(&self) -> TaskStatus
fn clone(&self) -> TaskStatus
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TaskStatus
impl Debug for TaskStatus
Source§impl<'de> Deserialize<'de> for TaskStatus
impl<'de> Deserialize<'de> for TaskStatus
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
Source§impl PartialEq for TaskStatus
impl PartialEq for TaskStatus
Source§impl Serialize for TaskStatus
impl Serialize for TaskStatus
impl Eq for TaskStatus
impl StructuralPartialEq for TaskStatus
Auto Trait Implementations§
impl Freeze for TaskStatus
impl RefUnwindSafe for TaskStatus
impl Send for TaskStatus
impl Sync for TaskStatus
impl Unpin for TaskStatus
impl UnsafeUnpin for TaskStatus
impl UnwindSafe for TaskStatus
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