Struct safe_network::messaging::WireMsg [−][src]
pub struct WireMsg { pub header: WireMsgHeader, pub payload: Bytes, }
Expand description
In order to send a message over the wire, it needs to be serialized along with a header (WireMsgHeader) which contains the information needed by the recipient to properly deserialize it. The WireMsg struct provides the utilities to serialize and deserialize messages.
Fields
header: WireMsgHeader
Message header
payload: Bytes
Serialised message
Implementations
Serializes the message provided. This function shall be used to
obtain the serialized payload which is needed to create the MsgKind
.
Once the caller obtains both the serialized payload and MsgKind
,
it can invoke the new_msg
function to instantiate a WireMsg
.
Creates a new WireMsg
with the provided serialized payload and MsgKind
.
pub fn new_section_info_msg(
query: &SectionInfoMsg,
dst_location: DstLocation
) -> Result<Self>
pub fn new_section_info_msg(
query: &SectionInfoMsg,
dst_location: DstLocation
) -> Result<Self>
Convenience function to create a new ‘SectionInfoMsg’. This function serializes the payload and assumes there is no need of a message authority.
Attempts to create an instance of WireMsg by deserialising the bytes provided. To succeed, the bytes should contain at least a valid WireMsgHeader.
Return the serialized WireMsg, which contains the WireMsgHeader bytes, followed by the payload bytes, i.e. the serialized Message.
Deserialize the payload from this WireMsg returning a MessageType instance.
Update the message ID
Return the destination section PublicKey for this message
Update the destination section PublicKey for this message
Update the destination XorName for this message
Return the destination for this message
Return the source section PublicKey for this message if it’s a NodeMsg
Convenience function which creates a temporary WireMsg from the provided bytes, returning the deserialized message.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for WireMsg
impl UnwindSafe for WireMsg
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self