pub struct StreamEvent {
pub timestamp_ms: u64,
pub kind: StreamEventKind,
}Expand description
A streaming event from an agent
Fields§
§timestamp_ms: u64Timestamp in milliseconds since session start
kind: StreamEventKindThe event kind
Implementations§
Source§impl StreamEvent
impl StreamEvent
Sourcepub fn new(kind: StreamEventKind) -> Self
pub fn new(kind: StreamEventKind) -> Self
Create a new event with the given kind
The timestamp will be set to 0 and should be updated by the store when the event is added.
Sourcepub fn with_timestamp(kind: StreamEventKind, timestamp_ms: u64) -> Self
pub fn with_timestamp(kind: StreamEventKind, timestamp_ms: u64) -> Self
Create a new event with an explicit timestamp
Sourcepub fn text_delta(text: impl Into<String>) -> Self
pub fn text_delta(text: impl Into<String>) -> Self
Create a text delta event
Sourcepub fn tool_start(name: &str, id: &str, input: &str) -> Self
pub fn tool_start(name: &str, id: &str, input: &str) -> Self
Create a tool start event
Sourcepub fn tool_result(name: &str, id: &str, success: bool) -> Self
pub fn tool_result(name: &str, id: &str, success: bool) -> Self
Create a tool result event
Sourcepub fn session_assigned(session_id: impl Into<String>) -> Self
pub fn session_assigned(session_id: impl Into<String>) -> Self
Create a session assigned event
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this event indicates completion (success or failure)
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if this event indicates successful completion
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
Get the session ID if this is a session assigned event
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamEvent
impl Debug for StreamEvent
Source§impl<'de> Deserialize<'de> for StreamEvent
impl<'de> Deserialize<'de> for StreamEvent
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
Source§impl PartialEq for StreamEvent
impl PartialEq for StreamEvent
Source§impl Serialize for StreamEvent
impl Serialize for StreamEvent
impl StructuralPartialEq for StreamEvent
Auto Trait Implementations§
impl Freeze for StreamEvent
impl RefUnwindSafe for StreamEvent
impl Send for StreamEvent
impl Sync for StreamEvent
impl Unpin 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