pub struct TypedMessage<T> {
pub message_type: String,
pub payload: T,
}Expand description
Native payload paired with an explicit wire name; this is not schema proof.
Fields§
§message_type: StringApplication wire name.
payload: TNative serializable value, often a borrowed prepared request.
Implementations§
Source§impl<T> TypedMessage<T>
impl<T> TypedMessage<T>
Sourcepub fn new(message_type: impl AsRef<str>, payload: T) -> TypedMessage<T>
pub fn new(message_type: impl AsRef<str>, payload: T) -> TypedMessage<T>
Pair a native payload with a wire name without performing I/O.
Trait Implementations§
Source§impl<P, T> IntoOutboundMessage<P> for TypedMessage<T>
impl<P, T> IntoOutboundMessage<P> for TypedMessage<T>
Source§fn into_outbound(
self,
ready: &<P as Protocol>::Ready,
codec: &(dyn EnvelopeCodec + 'static),
) -> Result<OutboundMessage, ClientError>
fn into_outbound( self, ready: &<P as Protocol>::Ready, codec: &(dyn EnvelopeCodec + 'static), ) -> Result<OutboundMessage, ClientError>
Validate before admission and encode only the layer supplied by the caller.
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