pub struct StreamEvent {
pub event_id: Option<u64>,
pub item: StreamItem,
}Expand description
A streamed StreamItem tagged with the server’s SSE event id (when the
transport supports it). A resilient client records the most recent event_id
and echoes it as Last-Event-ID on reconnect to resume without gaps.
The event_id is part of the a2a-rs resumption enhancement (see
subscribe_to_task); spec clients that only
read item are unaffected.
Fields§
§event_id: Option<u64>The server-assigned per-task event id, parsed from the SSE id: field.
None for the initial task snapshot, for transports without event ids,
or when talking to a spec-compliant server that does not emit id:.
item: StreamItemThe update payload.
Implementations§
Source§impl StreamEvent
impl StreamEvent
Sourcepub fn new(event_id: Option<u64>, item: StreamItem) -> Self
pub fn new(event_id: Option<u64>, item: StreamItem) -> Self
Construct a stream event.
Sourcepub fn untagged(item: StreamItem) -> Self
pub fn untagged(item: StreamItem) -> Self
A stream event with no id (initial snapshot / id-less transport).
Trait Implementations§
Source§impl Clone for StreamEvent
impl Clone for StreamEvent
Source§fn clone(&self) -> StreamEvent
fn clone(&self) -> StreamEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin for StreamEvent
impl UnsafeUnpin for StreamEvent
impl UnwindSafe for StreamEvent
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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