#[non_exhaustive]pub struct TaskStatus {
pub state: TaskState,
pub message: Option<Message>,
pub timestamp: Option<String>,
}Expand description
A container for the status of a task
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.state: TaskStateThe current state of this task.
message: Option<Message>A message associated with the status.
timestamp: Option<String>ISO 8601 Timestamp when the status was recorded. Example: “2023-10-27T10:00:00Z”
Implementations§
Source§impl TaskStatus
impl TaskStatus
Sourcepub const fn new(state: TaskState) -> TaskStatus
pub const fn new(state: TaskState) -> TaskStatus
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) -> TaskStatus
pub fn with_timestamp(state: TaskState) -> TaskStatus
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.
Source§impl TaskStatus
impl TaskStatus
Sourcepub fn with_message(self, message: Message) -> TaskStatus
pub fn with_message(self, message: Message) -> TaskStatus
Sets the message that goes with the state (for failed or
input-required, what the agent says about it).
Sourcepub fn at(self, timestamp: impl Into<String>) -> TaskStatus
pub fn at(self, timestamp: impl Into<String>) -> TaskStatus
Sets the timestamp to timestamp (ISO 8601, as the specification
writes it) where TaskStatus::with_timestamp would take the current
time.
Trait Implementations§
Source§impl Clone for TaskStatus
impl Clone for TaskStatus
Source§fn clone(&self) -> TaskStatus
fn clone(&self) -> TaskStatus
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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<TaskStatus, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TaskStatus, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for TaskStatus
Source§impl PartialEq for TaskStatus
impl PartialEq for TaskStatus
Source§impl Serialize for TaskStatus
impl Serialize for TaskStatus
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for TaskStatus
Source§impl TryFrom<TaskStatus> for TaskStatus
impl TryFrom<TaskStatus> for TaskStatus
Source§type Error = ConvertError
type Error = ConvertError
Source§fn try_from(
value: TaskStatus,
) -> Result<TaskStatus, <TaskStatus as TryFrom<TaskStatus>>::Error>
fn try_from( value: TaskStatus, ) -> Result<TaskStatus, <TaskStatus as TryFrom<TaskStatus>>::Error>
Source§impl TryFrom<TaskStatus> for TaskStatus
impl TryFrom<TaskStatus> for TaskStatus
Source§type Error = ConvertError
type Error = ConvertError
Source§fn try_from(
value: TaskStatus,
) -> Result<TaskStatus, <TaskStatus as TryFrom<TaskStatus>>::Error>
fn try_from( value: TaskStatus, ) -> Result<TaskStatus, <TaskStatus as TryFrom<TaskStatus>>::Error>
Auto Trait Implementations§
impl Forget for TaskStatus
impl Freeze for TaskStatus
impl Move 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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].