pub struct Message {
pub id: String,
pub source: String,
pub relation: Option<String>,
pub protocol: Version,
pub payload: Payload,
}Fields§
§id: String§source: String§relation: Option<String>§protocol: Version§payload: PayloadImplementations§
Source§impl Message
impl Message
Sourcepub fn new(
id: impl Into<String>,
source: impl Into<String>,
payload: impl Into<Payload>,
) -> Self
pub fn new( id: impl Into<String>, source: impl Into<String>, payload: impl Into<Payload>, ) -> Self
Builds an outbound 1.2.0 message. Validation occurs on encode.
Sourcepub fn decode(bytes: &[u8]) -> Result<Self, WireError>
pub fn decode(bytes: &[u8]) -> Result<Self, WireError>
Decodes with default resource budgets. An incompatible major returns the original ID and kind so the role can correlate a negative acknowledgement and suppress ack loops.
pub fn decode_with( bytes: &[u8], limits: DecodeLimits, ) -> Result<Self, WireError>
Sourcepub fn decode_for_reply(bytes: &[u8]) -> Result<Self, DecodeFailure>
pub fn decode_for_reply(bytes: &[u8]) -> Result<Self, DecodeFailure>
Provides a possible negative acknowledgement only after resolving an unambiguous envelope. The caller must still authorize the route and check the message direction. Code 1 denotes invalid schema data and code 2 a protocol violation. Major-version incompatibility produces a hint for any recognized non-ack message (REQ-3/4). Within the supported major, reads and standalone controls are eligible (REQ-27/28).
Sourcepub fn encode(&self) -> Result<Vec<u8>, WireError>
pub fn encode(&self) -> Result<Vec<u8>, WireError>
Encodes a validated envelope under the default payload and collection budgets.
pub fn validate(&self) -> Result<(), WireError>
Trait Implementations§
impl Eq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl Freeze for Message
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnsafeUnpin for Message
impl UnwindSafe for Message
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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