pub struct MessageEnvelope {
pub header: MessageHeader,
pub payload: Vec<u8>,
}Expand description
Envelope containing header and serialized payload.
Fields§
§header: MessageHeaderMessage header.
payload: Vec<u8>Serialized payload.
Implementations§
Source§impl MessageEnvelope
impl MessageEnvelope
Sourcepub fn new<M: RingMessage>(
message: &M,
source_kernel: u64,
dest_kernel: u64,
timestamp: HlcTimestamp,
) -> Self
pub fn new<M: RingMessage>( message: &M, source_kernel: u64, dest_kernel: u64, timestamp: HlcTimestamp, ) -> Self
Create a new envelope from a message.
Sourcepub fn total_size(&self) -> usize
pub fn total_size(&self) -> usize
Get total size (header + payload).
Sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_bytes(bytes: &[u8]) -> Result<Self>
Deserialize from bytes.
Sourcepub fn empty(
source_kernel: u64,
dest_kernel: u64,
timestamp: HlcTimestamp,
) -> Self
pub fn empty( source_kernel: u64, dest_kernel: u64, timestamp: HlcTimestamp, ) -> Self
Create an empty envelope (for testing).
Trait Implementations§
Source§impl Clone for MessageEnvelope
impl Clone for MessageEnvelope
Source§fn clone(&self) -> MessageEnvelope
fn clone(&self) -> MessageEnvelope
Returns a duplicate of the value. Read more
1.0.0§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 MessageEnvelope
impl RefUnwindSafe for MessageEnvelope
impl Send for MessageEnvelope
impl Sync for MessageEnvelope
impl Unpin for MessageEnvelope
impl UnwindSafe for MessageEnvelope
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.