pub struct Packet {
pub ptype: PacketType,
pub nsp: String,
pub data: Option<Value>,
pub id: Option<usize>,
pub attachment_count: u8,
pub attachments: Option<Vec<Bytes>>,
}
Expand description
A packet which gets sent or received during in the socket.io
protocol.
Fields§
§ptype: PacketType
§nsp: String
§data: Option<Value>
§id: Option<usize>
§attachment_count: u8
§attachments: Option<Vec<Bytes>>
Implementations§
Trait Implementations§
Source§impl TryFrom<&Bytes> for Packet
impl TryFrom<&Bytes> for Packet
Source§fn try_from(payload: &Bytes) -> Result<Packet>
fn try_from(payload: &Bytes) -> Result<Packet>
Decodes a packet given a Bytes
type.
The binary payload of a packet is not put at the end of the
stream as it gets handled and send by it’s own logic via the socket.
Therefore this method does not return the correct value for the
binary data, instead the socket is responsible for handling
this member. This is done because the attachment is usually
send in another packet.
impl Eq for Packet
impl StructuralPartialEq for Packet
Auto Trait Implementations§
impl Freeze for Packet
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
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,
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§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.