pub struct RawPacket {
pub id: i32,
pub body: Bytes,
}Expand description
A packet whose body has not been decoded yet.
The body is a zero-copy slice of the received (and, if needed, inflated) frame.
Fields§
§id: i32Packet id.
body: BytesPacket body after the id.
Implementations§
Source§impl RawPacket
impl RawPacket
Sourcepub fn decode_as<P: Packet>(&self) -> DecodeResult<P>
pub fn decode_as<P: Packet>(&self) -> DecodeResult<P>
Decodes the body as packet type P; checks the id and that the whole body is used.
Sourcepub fn from_packet<P: Packet>(p: &P) -> Result<Self, EncodeError>
pub fn from_packet<P: Packet>(p: &P) -> Result<Self, EncodeError>
Encodes a typed packet into a raw packet.
Trait Implementations§
impl Eq for RawPacket
impl StructuralPartialEq for RawPacket
Auto Trait Implementations§
impl !Freeze for RawPacket
impl RefUnwindSafe for RawPacket
impl Send for RawPacket
impl Sync for RawPacket
impl Unpin for RawPacket
impl UnsafeUnpin for RawPacket
impl UnwindSafe for RawPacket
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