pub struct MarshalledMessage {
pub body: MarshalledMessageBody,
pub dynheader: DynamicHeader,
pub typ: MessageType,
pub flags: u8,
}
Expand description
Message received by a connection or in preparation before being sent over a connection.
This represents a message while it is being built before it is sent over the connection. The body accepts everything that implements the Marshal trait (e.g. all basic types, strings, slices, Hashmaps,…..) And you can of course write an Marshal impl for your own datastructures. See the doc on the Marshal trait what you have to look out for when doing this though.
Fields§
§body: MarshalledMessageBody
§dynheader: DynamicHeader
§typ: MessageType
§flags: u8
Implementations§
Source§impl MarshalledMessage
impl MarshalledMessage
pub fn get_buf(&self) -> &[u8] ⓘ
pub fn get_sig(&self) -> &str
Sourcepub fn with_byteorder(b: ByteOrder) -> Self
pub fn with_byteorder(b: ByteOrder) -> Self
New messagebody with a chosen byteorder
Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves space for additional
bytes in the internal buffer. This is useful to reduce the amount of allocations done while marshalling,
if you can predict somewhat accuratly how many bytes you will be marshalling.
pub fn marshal_header( &self, serial: NonZeroU32, hdr_buf: &mut Vec<u8>, ) -> Result<(), Error>
Trait Implementations§
Source§impl Debug for MarshalledMessage
impl Debug for MarshalledMessage
Auto Trait Implementations§
impl Freeze for MarshalledMessage
impl RefUnwindSafe for MarshalledMessage
impl Send for MarshalledMessage
impl Sync for MarshalledMessage
impl Unpin for MarshalledMessage
impl UnwindSafe for MarshalledMessage
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