pub struct SessionEvent {
pub id: String,
pub timestamp: String,
pub event_type: String,
pub parent_id: Option<String>,
pub ephemeral: Option<bool>,
pub data: SessionEventData,
}Expand description
A parsed session event with typed data.
Fields§
§id: StringUnique event ID.
timestamp: StringISO 8601 timestamp.
event_type: StringOriginal type string (e.g., “assistant.message”).
parent_id: Option<String>Parent event ID, if any.
ephemeral: Option<bool>Whether this event is ephemeral.
data: SessionEventDataTyped event data.
Implementations§
Source§impl SessionEvent
impl SessionEvent
Sourcepub fn from_raw(raw: RawSessionEvent) -> Self
pub fn from_raw(raw: RawSessionEvent) -> Self
Convert a raw event to a typed event.
Sourcepub fn is_assistant_message(&self) -> bool
pub fn is_assistant_message(&self) -> bool
Check if this is an assistant message event.
Sourcepub fn is_assistant_message_delta(&self) -> bool
pub fn is_assistant_message_delta(&self) -> bool
Check if this is an assistant message delta event.
Sourcepub fn is_session_idle(&self) -> bool
pub fn is_session_idle(&self) -> bool
Check if this is a session idle event.
Sourcepub fn is_session_error(&self) -> bool
pub fn is_session_error(&self) -> bool
Check if this is a session error event.
Sourcepub fn is_terminal(&self) -> bool
pub fn is_terminal(&self) -> bool
Check if this is a terminal event (session ended).
Sourcepub fn as_assistant_message(&self) -> Option<&AssistantMessageData>
pub fn as_assistant_message(&self) -> Option<&AssistantMessageData>
Get assistant message data if this is an assistant.message event.
Sourcepub fn as_assistant_message_delta(&self) -> Option<&AssistantMessageDeltaData>
pub fn as_assistant_message_delta(&self) -> Option<&AssistantMessageDeltaData>
Get assistant message delta data if this is an assistant.message_delta event.
Sourcepub fn as_session_error(&self) -> Option<&SessionErrorData>
pub fn as_session_error(&self) -> Option<&SessionErrorData>
Get session error data if this is a session.error event.
Sourcepub fn as_tool_execution_complete(&self) -> Option<&ToolExecutionCompleteData>
pub fn as_tool_execution_complete(&self) -> Option<&ToolExecutionCompleteData>
Get tool execution complete data if this is a tool.execution_complete event.
Trait Implementations§
Source§impl Clone for SessionEvent
impl Clone for SessionEvent
Source§fn clone(&self) -> SessionEvent
fn clone(&self) -> SessionEvent
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 moreAuto Trait Implementations§
impl Freeze for SessionEvent
impl RefUnwindSafe for SessionEvent
impl Send for SessionEvent
impl Sync for SessionEvent
impl Unpin for SessionEvent
impl UnsafeUnpin for SessionEvent
impl UnwindSafe for SessionEvent
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