Struct sn_messaging::WireMsg[][src]

pub struct WireMsg { /* fields omitted */ }

Implementations

impl WireMsg[src]

pub fn new_ping_msg(dest: XorName, dest_section_pk: PublicKey) -> Self[src]

Creates a new instance of a ‘Ping’ message.

pub fn new_section_info_msg(
    query: &Message,
    dest: XorName,
    dest_section_pk: PublicKey
) -> Result<Self>
[src]

Creates a new instance keeping a (serialized) copy of the ‘SectionInfo’ message provided.

pub fn new_client_msg(
    msg: &ClientMsg,
    dest: XorName,
    dest_section_pk: PublicKey
) -> Result<Self>
[src]

Creates a new instance keeping a (serialized) copy of the client ‘Message’ message provided.

pub fn new_routing_msg(
    msg: &RoutingMsg,
    dest: XorName,
    dest_section_pk: PublicKey
) -> Result<Self>
[src]

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

pub fn new_node_msg(
    msg: &NodeMsg,
    dest: XorName,
    dest_section_pk: PublicKey,
    src_section_pk: Option<PublicKey>
) -> Result<Self>
[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 Message.

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

Deserialize the payload from this WireMsg returning a Message instance.

pub fn dest_section_pk(&self) -> PublicKey[src]

Return the destination section PublicKey for this message

pub fn dest(&self) -> XorName[src]

Return the destination for this message

pub fn src_section_pk(&self) -> Option<PublicKey>[src]

Return the source section PublicKey for this message if it’s a NodeMsg and it was provided in the header of message.

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_section_info_msg(
    query: &Message,
    dest: XorName,
    dest_section_pk: PublicKey
) -> Result<Bytes>
[src]

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

pub fn serialize_client_msg(
    msg: &ClientMsg,
    dest: XorName,
    dest_section_pk: PublicKey
) -> Result<Bytes>
[src]

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

pub fn serialize_routing_msg(
    msg: &RoutingMsg,
    dest: XorName,
    dest_section_pk: PublicKey
) -> Result<Bytes>
[src]

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

pub fn serialize_node_msg(
    msg: &NodeMsg,
    dest: XorName,
    dest_section_pk: PublicKey,
    src_section_pk: Option<PublicKey>
) -> Result<Bytes>
[src]

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

Trait Implementations

impl Debug for WireMsg[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl PartialEq<WireMsg> for WireMsg[src]

fn eq(&self, other: &WireMsg) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &WireMsg) -> bool[src]

This method tests for !=.

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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

pub fn vzip(self) -> V