pub struct Task {Show 15 fields
pub id: String,
pub tool_name: String,
pub arguments: Value,
pub status: TaskStatus,
pub created_at: Instant,
pub created_at_str: String,
pub last_updated_at_str: String,
pub ttl: u64,
pub poll_interval: u64,
pub status_message: Option<String>,
pub result: Option<CallToolResult>,
pub error: Option<String>,
pub cancellation_token: CancellationToken,
pub completed_at: Option<Instant>,
pub completion_notify: Arc<Notify>,
}Expand description
Internal task representation with full state
Fields§
§id: StringUnique task identifier
tool_name: StringName of the tool being executed
arguments: ValueArguments passed to the tool
status: TaskStatusCurrent task status
created_at: InstantWhen the task was created
created_at_str: StringISO 8601 timestamp string
last_updated_at_str: StringISO 8601 timestamp of last state change
ttl: u64Time-to-live in milliseconds (for cleanup after completion)
poll_interval: u64Suggested polling interval in milliseconds
status_message: Option<String>Human-readable status message
result: Option<CallToolResult>The result of the tool call (when completed)
error: Option<String>Error message (when failed)
cancellation_token: CancellationTokenCancellation token for aborting the task
completed_at: Option<Instant>When the task reached terminal status (for TTL tracking)
completion_notify: Arc<Notify>Notified when task reaches a terminal state
Implementations§
Source§impl Task
impl Task
Sourcepub fn to_task_object(&self) -> TaskObject
pub fn to_task_object(&self) -> TaskObject
Convert to TaskObject for API responses
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Check if this task should be cleaned up (TTL expired)
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Check if the task has been cancelled
Trait Implementations§
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
Mutably borrows from an owned value. Read more