Struct discortp::discord::KeepalivePacket
source · pub struct KeepalivePacket<'p> { /* private fields */ }
Expand description
A structure enabling manipulation of on the wire packets
Implementations§
source§impl<'a> KeepalivePacket<'a>
impl<'a> KeepalivePacket<'a>
sourcepub fn new<'p>(packet: &'p [u8]) -> Option<KeepalivePacket<'p>>
pub fn new<'p>(packet: &'p [u8]) -> Option<KeepalivePacket<'p>>
Constructs a new KeepalivePacket. If the provided buffer is less than the minimum required packet size, this will return None.
sourcepub fn owned(packet: Vec<u8>) -> Option<KeepalivePacket<'static>>
pub fn owned(packet: Vec<u8>) -> Option<KeepalivePacket<'static>>
Constructs a new KeepalivePacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the KeepalivePacket will own its own data and the underlying buffer will be dropped when the KeepalivePacket is.
sourcepub fn to_immutable<'p>(&'p self) -> KeepalivePacket<'p>
pub fn to_immutable<'p>(&'p self) -> KeepalivePacket<'p>
Maps from a KeepalivePacket to a KeepalivePacket
sourcepub fn consume_to_immutable(self) -> KeepalivePacket<'a>
pub fn consume_to_immutable(self) -> KeepalivePacket<'a>
Maps from a KeepalivePacket to a KeepalivePacket while consuming the source
sourcepub const fn minimum_packet_size() -> usize
pub const fn minimum_packet_size() -> usize
The minimum size (in bytes) a packet of this type can be. It’s based on the total size of the fixed-size fields.
sourcepub fn packet_size(_packet: &Keepalive) -> usize
pub fn packet_size(_packet: &Keepalive) -> usize
The size (in bytes) of a Keepalive instance when converted into a byte-array
Trait Implementations§
source§impl<'p> Debug for KeepalivePacket<'p>
impl<'p> Debug for KeepalivePacket<'p>
source§impl<'p> FromPacket for KeepalivePacket<'p>
impl<'p> FromPacket for KeepalivePacket<'p>
source§impl<'a> Packet for KeepalivePacket<'a>
impl<'a> Packet for KeepalivePacket<'a>
source§impl<'a> PacketSize for KeepalivePacket<'a>
impl<'a> PacketSize for KeepalivePacket<'a>
source§fn packet_size(&self) -> usize
fn packet_size(&self) -> usize
source§impl<'p> PartialEq for KeepalivePacket<'p>
impl<'p> PartialEq for KeepalivePacket<'p>
source§fn eq(&self, other: &KeepalivePacket<'p>) -> bool
fn eq(&self, other: &KeepalivePacket<'p>) -> bool
self
and other
values to be equal, and is used
by ==
.