pub struct EventEnvelope { /* private fields */ }Expand description
A versioned observable event envelope.
Implementations§
Source§impl EventEnvelope
impl EventEnvelope
Sourcepub fn new(
event_id: EventId,
session_id: SessionId,
run_id: Option<RunId>,
turn_id: Option<TurnId>,
sequence: SessionSequence,
timestamp: ProtocolTimestamp,
metadata: ProtocolMetadata,
event: AgentEvent,
) -> Result<Self, EventValidationError>
pub fn new( event_id: EventId, session_id: SessionId, run_id: Option<RunId>, turn_id: Option<TurnId>, sequence: SessionSequence, timestamp: ProtocolTimestamp, metadata: ProtocolMetadata, event: AgentEvent, ) -> Result<Self, EventValidationError>
Creates a validated current-version event envelope.
§Errors
Returns an error when references do not match the event kind or the payload exceeds protocol bounds.
Sourcepub fn inspect_value(value: Value) -> Result<EventInspection, EventDecodeError>
pub fn inspect_value(value: Value) -> Result<EventInspection, EventDecodeError>
Inspects untrusted event JSON with explicit unknown-event behavior.
§Errors
Returns an error for malformed known events, unknown state-bearing events, invalid compatibility markers, or unsupported protocol majors.
Sourcepub const fn protocol_version(&self) -> ProtocolVersion
pub const fn protocol_version(&self) -> ProtocolVersion
Returns the envelope protocol version.
Sourcepub const fn session_id(&self) -> SessionId
pub const fn session_id(&self) -> SessionId
Returns the session identifier.
Sourcepub const fn turn_id(&self) -> Option<TurnId>
pub const fn turn_id(&self) -> Option<TurnId>
Returns the related turn identifier when present.
Sourcepub const fn sequence(&self) -> SessionSequence
pub const fn sequence(&self) -> SessionSequence
Returns the authoritative session-local event sequence.
Sourcepub const fn timestamp(&self) -> ProtocolTimestamp
pub const fn timestamp(&self) -> ProtocolTimestamp
Returns the event timestamp.
Sourcepub const fn metadata(&self) -> &ProtocolMetadata
pub const fn metadata(&self) -> &ProtocolMetadata
Returns bounded extension metadata.
Sourcepub const fn event(&self) -> &AgentEvent
pub const fn event(&self) -> &AgentEvent
Returns the typed event payload.
Sourcepub const fn event_type(&self) -> AgentEventType
pub const fn event_type(&self) -> AgentEventType
Returns the stable event discriminator.
Trait Implementations§
Source§impl Clone for EventEnvelope
impl Clone for EventEnvelope
Source§fn clone(&self) -> EventEnvelope
fn clone(&self) -> EventEnvelope
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 moreSource§impl Debug for EventEnvelope
impl Debug for EventEnvelope
Source§impl<'de> Deserialize<'de> for EventEnvelope
impl<'de> Deserialize<'de> for EventEnvelope
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 EventEnvelope
impl PartialEq for EventEnvelope
Source§impl Serialize for EventEnvelope
impl Serialize for EventEnvelope
impl StructuralPartialEq for EventEnvelope
Auto Trait Implementations§
impl Freeze for EventEnvelope
impl RefUnwindSafe for EventEnvelope
impl Send for EventEnvelope
impl Sync for EventEnvelope
impl Unpin for EventEnvelope
impl UnsafeUnpin for EventEnvelope
impl UnwindSafe for EventEnvelope
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