pub struct MsgMeta {
pub method: String,
pub flags: MsgFlags,
pub msgid: u64,
}Expand description
Message metadata containing routing and control information.
The metadata is serialized at the beginning of each message and contains:
- Method name for routing
- Flags controlling message behavior
- Message ID for request/response correlation
Fields§
§method: StringThe fully qualified method name (e.g., “ServiceName/method_name”).
flags: MsgFlagsMessage flags controlling behavior and format.
msgid: u64Message ID for correlating requests and responses.
Implementations§
Source§impl MsgMeta
impl MsgMeta
Source§impl MsgMeta
impl MsgMeta
Sourcepub fn serialize_to<M: SendMsg, P: Serialize>(
&self,
payload: &P,
msg: &mut M,
) -> Result<()>
pub fn serialize_to<M: SendMsg, P: Serialize>( &self, payload: &P, msg: &mut M, ) -> Result<()>
Serializes the metadata and payload into a message buffer.
This method handles the complete serialization process:
- Writes a 4-byte length prefix for the metadata
- Serializes the metadata (JSON or MessagePack based on flags)
- Serializes the payload (JSON or MessagePack based on flags)
- Updates the length prefix with the actual metadata size
§Type Parameters
M- The message buffer type implementingSendMsgP- The payload type to serialize
§Arguments
payload- The data to serialize as the message payloadmsg- The message buffer to write to
§Errors
Returns an error if:
- Buffer preparation fails
- Serialization fails
- Message finalization fails
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MsgMeta
impl<'de> Deserialize<'de> for MsgMeta
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for MsgMeta
impl StructuralPartialEq for MsgMeta
Auto Trait Implementations§
impl Freeze for MsgMeta
impl RefUnwindSafe for MsgMeta
impl Send for MsgMeta
impl Sync for MsgMeta
impl Unpin for MsgMeta
impl UnsafeUnpin for MsgMeta
impl UnwindSafe for MsgMeta
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.