#[non_exhaustive]pub struct TaskEvent {
pub task_id: String,
pub status: TaskStatus,
pub message: Option<Message>,
pub final_event: bool,
pub event_id: u64,
}Expand description
Lifecycle event emitted by crate::task_store::A2aTaskStore on each
mutating write. Serialised as the SSE data: payload for
SubscribeToTask / SendStreamingMessage responses in the HTTP
transport (the http cargo feature, not yet wired).
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: StringThe task whose state transitioned.
status: TaskStatusCurrent status post-transition.
message: Option<Message>Last message in the task history, if any.
final_event: booltrue if status is terminal (Completed / Failed / Canceled /
Rejected); stream consumers close after receiving it.
event_id: u64Monotonic per-task event id used by SSE Last-Event-ID
resumption. Set by the HTTP transport when the event is yielded;
defaults to 0 for events constructed outside the transport
(e.g. synthetic initial replays from task_store).
Implementations§
Source§impl TaskEvent
impl TaskEvent
Sourcepub fn new(
task_id: impl Into<String>,
status: TaskStatus,
message: Option<Message>,
final_event: bool,
) -> Self
pub fn new( task_id: impl Into<String>, status: TaskStatus, message: Option<Message>, final_event: bool, ) -> Self
Construct a TaskEvent. The only public constructor — required because
#[non_exhaustive] prevents struct-literal construction outside this
crate. event_id defaults to 0; the HTTP transport overwrites it
when the event is yielded into an SSE stream.
Sourcepub fn with_event_id(self, event_id: u64) -> Self
pub fn with_event_id(self, event_id: u64) -> Self
Override the monotonic event id assigned by the store or transport.
Used by A2aTaskStore::put to stamp broadcast events, and by
dispatch_send_streaming / subscribe_snapshot_then_tail to stamp
synthetic initial events before they enter the SSE stream.