pub struct TaskStatusUpdateEvent {
pub task_id: String,
pub context_id: String,
pub status: TaskStatus,
pub is_final: bool,
pub metadata: BTreeMap<String, Value>,
}Expand description
A streaming event that reports a task’s status change.
Wire form:
{
"taskId": "task-1",
"contextId": "context-1",
"status": { "state": "working" },
"final": false,
"metadata": { ... }
}taskId, contextId, status, and
final are required; metadata is
optional. The final field is the
JSON-spec extension that lets a
client close the stream without
mirroring the proto’s terminal-state
list.
Fields§
§task_id: StringThe task’s id. Required.
context_id: StringThe task’s context id. Required.
status: TaskStatusThe task’s new status. Required.
is_final: boolWhether this is the last event for
the stream. Required by the JSON
spec; a value of true means the
client can close the connection.
metadata: BTreeMap<String, Value>Per-event metadata.
Implementations§
Source§impl TaskStatusUpdateEvent
impl TaskStatusUpdateEvent
Sourcepub fn new(
task_id: impl Into<String>,
context_id: impl Into<String>,
status: TaskStatus,
) -> Self
pub fn new( task_id: impl Into<String>, context_id: impl Into<String>, status: TaskStatus, ) -> Self
Starts a new event with task_id,
context_id, and status. The
final field defaults to false.
Use
with_final
to mark the event as the last
one in the stream.
Sourcepub const fn with_final(self) -> Self
pub const fn with_final(self) -> Self
Sets the final flag to true.
Trait Implementations§
Source§impl Clone for TaskStatusUpdateEvent
impl Clone for TaskStatusUpdateEvent
Source§impl Debug for TaskStatusUpdateEvent
impl Debug for TaskStatusUpdateEvent
Source§impl<'de> Deserialize<'de> for TaskStatusUpdateEvent
impl<'de> Deserialize<'de> for TaskStatusUpdateEvent
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
impl Eq for TaskStatusUpdateEvent
Source§impl From<TaskStatusUpdateEvent> for StreamingEvent
impl From<TaskStatusUpdateEvent> for StreamingEvent
Source§fn from(event: TaskStatusUpdateEvent) -> Self
fn from(event: TaskStatusUpdateEvent) -> Self
Converts to this type from the input type.
Source§impl PartialEq for TaskStatusUpdateEvent
impl PartialEq for TaskStatusUpdateEvent
Source§impl Serialize for TaskStatusUpdateEvent
impl Serialize for TaskStatusUpdateEvent
impl StructuralPartialEq for TaskStatusUpdateEvent
Auto Trait Implementations§
impl Freeze for TaskStatusUpdateEvent
impl RefUnwindSafe for TaskStatusUpdateEvent
impl Send for TaskStatusUpdateEvent
impl Sync for TaskStatusUpdateEvent
impl Unpin for TaskStatusUpdateEvent
impl UnsafeUnpin for TaskStatusUpdateEvent
impl UnwindSafe for TaskStatusUpdateEvent
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