pub struct NamespacedMessage {
pub from: String,
pub namespace: String,
pub msg_type: String,
pub payload: Value,
pub timestamp: Option<u64>,
}Expand description
A message received on a specific namespace.
This is the public type that Node::subscribe delivers to application
code. It contains the deserialized envelope fields plus the sender’s peer ID.
Fields§
§from: StringStable node ID of the sender.
namespace: StringNamespace the message was sent on.
msg_type: StringApplication-defined message type within the namespace.
payload: ValueOpaque JSON payload.
timestamp: Option<u64>Millisecond Unix timestamp from the sender, if set.
Implementations§
Source§impl NamespacedMessage
impl NamespacedMessage
Sourcepub fn payload_bytes(&self) -> Option<Vec<u8>>
pub fn payload_bytes(&self) -> Option<Vec<u8>>
Decode the payload of a send_bytes /
broadcast_bytes message.
Returns None unless msg_type == "bytes" with a valid base64
data field.
Trait Implementations§
Source§impl Clone for NamespacedMessage
impl Clone for NamespacedMessage
Source§fn clone(&self) -> NamespacedMessage
fn clone(&self) -> NamespacedMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NamespacedMessage
impl RefUnwindSafe for NamespacedMessage
impl Send for NamespacedMessage
impl Sync for NamespacedMessage
impl Unpin for NamespacedMessage
impl UnsafeUnpin for NamespacedMessage
impl UnwindSafe for NamespacedMessage
Blanket Implementations§
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