pub struct Task {
pub task_id: String,
pub status: TaskStatus,
pub status_message: Option<String>,
pub created_at: Option<String>,
pub last_updated_at: Option<String>,
pub ttl: Option<u64>,
pub poll_interval: Option<u64>,
}Expand description
Represents an asynchronous task (MCP 2025-11-25 experimental)
Tasks enable long-running operations that can be polled for status, cancelled, and have their results retrieved asynchronously.
Fields§
§task_id: StringUnique identifier for the task
status: TaskStatusCurrent execution status
status_message: Option<String>Optional human-readable status description
created_at: Option<String>ISO 8601 timestamp of task creation
last_updated_at: Option<String>ISO 8601 timestamp of last status change
ttl: Option<u64>Time-to-live in seconds before automatic cleanup
poll_interval: Option<u64>Suggested polling interval in milliseconds
Implementations§
Source§impl Task
impl Task
Sourcepub fn with_timestamps(
task_id: impl Into<String>,
created_at: impl Into<String>,
) -> Self
pub fn with_timestamps( task_id: impl Into<String>, created_at: impl Into<String>, ) -> Self
Create a new task with timestamps
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if the task is in a terminal state
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the task is still running
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
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
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnwindSafe for Task
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)