Struct socketio_rs::Packet
source · 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
sourceimpl TryFrom<&Bytes> for Packet
impl TryFrom<&Bytes> for Packet
sourcefn 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 StructuralEq for Packet
impl StructuralPartialEq for Packet
Auto Trait Implementations
impl RefUnwindSafe for Packet
impl Send for Packet
impl Sync for Packet
impl Unpin for Packet
impl UnwindSafe for Packet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.