Struct routing::messaging::MpidMessage [−][src]
pub struct MpidMessage { /* fields omitted */ }
A full message including header and body which can be sent to or retrieved from the network.
Methods
impl MpidMessage
[src]
impl MpidMessage
pub fn new(
sender: XorName,
metadata: Vec<u8>,
recipient: XorName,
body: Vec<u8>,
secret_key: &SecretKey
) -> Result<MpidMessage, Error>
[src]
pub fn new(
sender: XorName,
metadata: Vec<u8>,
recipient: XorName,
body: Vec<u8>,
secret_key: &SecretKey
) -> Result<MpidMessage, Error>
Constructor.
sender
and metadata
are used to construct an MpidHeader
member, accessed via the
header()
getter. For details on these arguments, see
MpidHeader::new().
recipient
represents the name of the intended receiver of the message.
body
is arbitrary, user-supplied data representing the main portion of the message. It
must not exceed MAX_BODY_SIZE
. It can be empty if desired.
An error will be returned if body
exceeds MAX_BODY_SIZE
, if
MpidHeader::new() fails or if
serialisation during the signing process fails.
pub fn header(&self) -> &MpidHeader
[src]
pub fn header(&self) -> &MpidHeader
Getter for MpidHeader
member, created when calling new()
.
pub fn recipient(&self) -> &XorName
[src]
pub fn recipient(&self) -> &XorName
The name of the intended receiver of the message.
pub fn body(&self) -> &Vec<u8>
[src]
pub fn body(&self) -> &Vec<u8>
Arbitrary, user-supplied data representing the main portion of the message.
pub fn name(&self) -> Result<XorName, Error>
[src]
pub fn name(&self) -> Result<XorName, Error>
The name of the message, equivalent to the
MpidHeader::name()
. As per that getter, this is
relatively expensive, so its use should be minimised.
pub fn verify(&self, public_key: &PublicKey) -> bool
[src]
pub fn verify(&self, public_key: &PublicKey) -> bool
Validates the message and header signatures against the provided PublicKey
.
Trait Implementations
impl PartialEq for MpidMessage
[src]
impl PartialEq for MpidMessage
fn eq(&self, other: &MpidMessage) -> bool
[src]
fn eq(&self, other: &MpidMessage) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &MpidMessage) -> bool
[src]
fn ne(&self, other: &MpidMessage) -> bool
This method tests for !=
.
impl Eq for MpidMessage
[src]
impl Eq for MpidMessage
impl Hash for MpidMessage
[src]
impl Hash for MpidMessage
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for MpidMessage
[src]
impl Clone for MpidMessage
fn clone(&self) -> MpidMessage
[src]
fn clone(&self) -> MpidMessage
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for MpidMessage
[src]
impl Debug for MpidMessage
Auto Trait Implementations
impl Send for MpidMessage
impl Send for MpidMessage
impl Sync for MpidMessage
impl Sync for MpidMessage