Struct sn_messaging::WireMsg[][src]

pub struct WireMsg { /* fields omitted */ }

Implementations

impl WireMsg[src]

pub fn new_ping_msg() -> WireMsg[src]

Creates a new instance of a 'Ping' message.

pub fn new_infrastructure_query(query: &Message) -> Result<WireMsg>[src]

Creates a new instance keeping a (serialized) copy of the 'InfrastructureMessage' message provided.

pub fn new_client_msg(msg: &MsgEnvelope) -> Result<WireMsg>[src]

Creates a new instance keeping a (serialized) copy of the client 'MsgEnvelope' message provided.

pub fn new_node_msg(msg: &NodeMessage) -> Result<WireMsg>[src]

Creates a new instance keeping a (serialized) copy of the node 'Message' message provided.

pub fn from(bytes: Bytes) -> Result<Self>[src]

Attempts to create an instance of WireMsg by deserialising the bytes provided. To succeed, the bytes should contain at least a valid WireMsgHeader.

pub fn serialize(&self) -> Result<Bytes>[src]

Return the serialized WireMsg, which contains the WireMsgHeader bytes, followed by the payload bytes, i.e. the serialized MsgEnvelope.

pub fn to_message(&self) -> Result<MessageType>[src]

Deserialize the payload from this WireMsg returning a Message instance.

pub fn deserialize(bytes: Bytes) -> Result<MessageType>[src]

Convenience function which creates a temporary WireMsg from the provided bytes, returning the deserialized message.

pub fn serialize_infrastructure_msg(query: &Message) -> Result<Bytes>[src]

Convenience function which creates a temporary WireMsg from the provided MsgEnvelope, returning the serialized WireMsg.

pub fn serialize_client_msg(msg: &MsgEnvelope) -> Result<Bytes>[src]

Convenience function which creates a temporary WireMsg from the provided MsgEnvelope, returning the serialized WireMsg.

pub fn serialize_node_msg(msg: &NodeMessage) -> Result<Bytes>[src]

Convenience function which creates a temporary WireMsg from the provided node::Messsage, returning the serialized WireMsg.

Trait Implementations

impl Debug for WireMsg[src]

impl PartialEq<WireMsg> for WireMsg[src]

impl StructuralPartialEq for WireMsg[src]

Auto Trait Implementations

impl RefUnwindSafe for WireMsg

impl Send for WireMsg

impl Sync for WireMsg

impl Unpin for WireMsg

impl UnwindSafe for WireMsg

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,