pub struct CommandEnvelope { /* private fields */ }Expand description
A versioned command transport envelope.
Implementations§
Source§impl CommandEnvelope
impl CommandEnvelope
Sourcepub fn new(
command_id: CommandId,
session_id: Option<SessionId>,
timestamp: ProtocolTimestamp,
command: AgentCommand,
) -> Result<Self, CommandValidationError>
pub fn new( command_id: CommandId, session_id: Option<SessionId>, timestamp: ProtocolTimestamp, command: AgentCommand, ) -> Result<Self, CommandValidationError>
Creates a validated current-version command envelope.
§Errors
Returns an error when session presence or command payload invariants fail.
Sourcepub fn decode_value(value: Value) -> Result<Self, CommandDecodeError>
pub fn decode_value(value: Value) -> Result<Self, CommandDecodeError>
Decodes a JSON value while preserving unsupported-command classification.
§Errors
Returns CommandDecodeError::UnsupportedType for an unknown safe
discriminator and CommandDecodeError::Invalid for malformed input.
Sourcepub const fn protocol_version(&self) -> ProtocolVersion
pub const fn protocol_version(&self) -> ProtocolVersion
Returns the protocol version read from or written to the envelope.
Sourcepub const fn command_id(&self) -> CommandId
pub const fn command_id(&self) -> CommandId
Returns the command identifier.
Sourcepub const fn session_id(&self) -> Option<SessionId>
pub const fn session_id(&self) -> Option<SessionId>
Returns the target session, absent only for session creation.
Sourcepub const fn timestamp(&self) -> ProtocolTimestamp
pub const fn timestamp(&self) -> ProtocolTimestamp
Returns the command timestamp.
Sourcepub const fn command(&self) -> &AgentCommand
pub const fn command(&self) -> &AgentCommand
Returns the command payload.
Sourcepub const fn command_type(&self) -> AgentCommandType
pub const fn command_type(&self) -> AgentCommandType
Returns the stable command discriminator.
Trait Implementations§
Source§impl Clone for CommandEnvelope
impl Clone for CommandEnvelope
Source§fn clone(&self) -> CommandEnvelope
fn clone(&self) -> CommandEnvelope
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 CommandEnvelope
impl Debug for CommandEnvelope
Source§impl<'de> Deserialize<'de> for CommandEnvelope
impl<'de> Deserialize<'de> for CommandEnvelope
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 CommandEnvelope
impl PartialEq for CommandEnvelope
Source§impl Serialize for CommandEnvelope
impl Serialize for CommandEnvelope
impl StructuralPartialEq for CommandEnvelope
Auto Trait Implementations§
impl Freeze for CommandEnvelope
impl RefUnwindSafe for CommandEnvelope
impl Send for CommandEnvelope
impl Sync for CommandEnvelope
impl Unpin for CommandEnvelope
impl UnsafeUnpin for CommandEnvelope
impl UnwindSafe for CommandEnvelope
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