pub struct PacketMessage {
pub msg_type: i32,
pub payload: Vec<u8>,
}Expand description
Packet message passed to packet-list rewriters.
Fields§
§msg_type: i32Inner packet message type.
payload: Vec<u8>Encoded inner packet message payload.
Implementations§
Source§impl PacketMessage
impl PacketMessage
Sourcepub fn new(msg_type: i32, payload: impl Into<Vec<u8>>) -> Self
pub fn new(msg_type: i32, payload: impl Into<Vec<u8>>) -> Self
Creates a packet message from a message type and encoded payload.
Sourcepub fn encoded<M>(msg_type: i32, message: &M) -> Selfwhere
M: Message,
pub fn encoded<M>(msg_type: i32, message: &M) -> Selfwhere
M: Message,
Creates a packet message by encoding a protobuf payload.
Sourcepub fn decode<M>(&self) -> Result<M, ParserError>
pub fn decode<M>(&self) -> Result<M, ParserError>
Decodes the packet message payload as a protobuf message.
Sourcepub fn replace_with<M>(&mut self, message: &M)where
M: Message,
pub fn replace_with<M>(&mut self, message: &M)where
M: Message,
Replaces the packet message payload with an encoded protobuf message.
Trait Implementations§
Source§impl Clone for PacketMessage
impl Clone for PacketMessage
Source§fn clone(&self) -> PacketMessage
fn clone(&self) -> PacketMessage
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 PacketMessage
impl RefUnwindSafe for PacketMessage
impl Send for PacketMessage
impl Sync for PacketMessage
impl Unpin for PacketMessage
impl UnsafeUnpin for PacketMessage
impl UnwindSafe for PacketMessage
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