pub struct TypedMessage<T> {
pub message_type: MessageType,
pub payload: T,
}Expand description
A message described by protocol type and a native serializable payload.
Use this form when Rust should CBOR-encode the payload. The payload type must
serialize to the shape expected by microsandbox-protocol for
message_type.
Fields§
§message_type: MessageTypeProtocol message type.
payload: TNative payload to CBOR-encode.
Implementations§
Source§impl<T> TypedMessage<T>
impl<T> TypedMessage<T>
Sourcepub fn new(message_type: MessageType, payload: T) -> Self
pub fn new(message_type: MessageType, payload: T) -> Self
Create a typed message from a protocol type and native payload.
Trait Implementations§
Source§impl<T: Clone> Clone for TypedMessage<T>
impl<T: Clone> Clone for TypedMessage<T>
Source§fn clone(&self) -> TypedMessage<T>
fn clone(&self) -> TypedMessage<T>
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<T: Debug> Debug for TypedMessage<T>
impl<T: Debug> Debug for TypedMessage<T>
Source§impl<T> IntoOutboundMessage for TypedMessage<T>where
T: Serialize,
impl<T> IntoOutboundMessage for TypedMessage<T>where
T: Serialize,
Source§fn into_outbound_message(
self,
protocol_version: u8,
negotiated_version: u8,
) -> AgentClientResult<OutboundMessage>
fn into_outbound_message( self, protocol_version: u8, negotiated_version: u8, ) -> AgentClientResult<OutboundMessage>
Encode the outbound message for a connection. Read more
Auto Trait Implementations§
impl<T> Freeze for TypedMessage<T>where
T: Freeze,
impl<T> RefUnwindSafe for TypedMessage<T>where
T: RefUnwindSafe,
impl<T> Send for TypedMessage<T>where
T: Send,
impl<T> Sync for TypedMessage<T>where
T: Sync,
impl<T> Unpin for TypedMessage<T>where
T: Unpin,
impl<T> UnsafeUnpin for TypedMessage<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TypedMessage<T>where
T: UnwindSafe,
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