#[non_exhaustive]pub struct Task {
pub task_id: String,
pub status: TaskStatus,
pub status_message: Option<String>,
pub created_at: String,
pub last_updated_at: String,
pub ttl_ms: Option<u64>,
pub poll_interval_ms: Option<u64>,
}Expand description
Operational metadata about ongoing work (spec Task, SEP-2663).
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.task_id: StringStable identifier for this task, generated by the server.
status: TaskStatusCurrent task status.
status_message: Option<String>Optional message describing the current task state. This MAY be exposed to the end-user or model.
created_at: StringISO 8601 timestamp when the task was created.
last_updated_at: StringISO 8601 timestamp when the task was last updated.
ttl_ms: Option<u64>Time-to-live duration from creation in integer milliseconds; None
(serialized as null) means unlimited. The server may discard the task
after the TTL elapses. This value MAY change over the lifetime of a task.
poll_interval_ms: Option<u64>Suggested polling interval in integer milliseconds. Clients SHOULD honor this value to avoid overwhelming the server. This value MAY change over the lifetime of a task.
Implementations§
Source§impl Task
impl Task
Sourcepub fn new(
task_id: impl Into<String>,
status: TaskStatus,
created_at: impl Into<String>,
last_updated_at: impl Into<String>,
) -> Task
pub fn new( task_id: impl Into<String>, status: TaskStatus, created_at: impl Into<String>, last_updated_at: impl Into<String>, ) -> Task
Create a new task with required fields.
Sourcepub fn with_status_message(self, status_message: impl Into<String>) -> Task
pub fn with_status_message(self, status_message: impl Into<String>) -> Task
Set the status message.
Sourcepub fn with_ttl_ms(self, ttl_ms: u64) -> Task
pub fn with_ttl_ms(self, ttl_ms: u64) -> Task
Set the TTL in milliseconds. None means unlimited retention.
Sourcepub fn with_poll_interval_ms(self, poll_interval_ms: u64) -> Task
pub fn with_poll_interval_ms(self, poll_interval_ms: u64) -> Task
Set the suggested poll interval in milliseconds.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Task, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Task, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Task
impl JsonSchema for Task
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl Serialize for Task
impl Serialize for Task
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 Task
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnsafeUnpin for Task
impl UnwindSafe for Task
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
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>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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