[−][src]Struct discortp::discord::IpDiscoveryPacket
A structure enabling manipulation of on the wire packets
Methods
impl<'a> IpDiscoveryPacket<'a>
[src]
pub fn new<'p>(packet: &'p [u8]) -> Option<IpDiscoveryPacket<'p>>
[src]
Constructs a new IpDiscoveryPacket. If the provided buffer is less than the minimum required packet size, this will return None.
pub fn owned(packet: Vec<u8>) -> Option<IpDiscoveryPacket<'static>>
[src]
Constructs a new IpDiscoveryPacket. If the provided buffer is less than the minimum required packet size, this will return None. With this constructor the IpDiscoveryPacket will own its own data and the underlying buffer will be dropped when the IpDiscoveryPacket is.
pub fn to_immutable<'p>(&'p self) -> IpDiscoveryPacket<'p>
[src]
Maps from a IpDiscoveryPacket to a IpDiscoveryPacket
pub fn consume_to_immutable(self) -> IpDiscoveryPacket<'a>
[src]
Maps from a IpDiscoveryPacket to a IpDiscoveryPacket while consuming the source
pub const fn minimum_packet_size() -> usize
[src]
The minimum size (in bytes) a packet of this type can be. It's based on the total size of the fixed-size fields.
pub fn packet_size(_packet: &IpDiscovery) -> usize
[src]
The size (in bytes) of a IpDiscovery instance when converted into a byte-array
pub fn get_pkt_type(&self) -> IpDiscoveryType
[src]
Get the value of the pkt_type field
pub fn get_length(&self) -> u16be
[src]
Get the length field. This field is always stored big-endian within the struct, but this accessor returns host order.
pub fn get_ssrc(&self) -> u32be
[src]
Get the ssrc field. This field is always stored big-endian within the struct, but this accessor returns host order.
pub fn get_address_raw(&self) -> &[u8]
[src]
Get the raw &u8 value of the address field, without copying
pub fn get_address(&self) -> Vec<u8>
[src]
Get the value of the address field (copies contents)
pub fn get_port(&self) -> u16be
[src]
Get the port field. This field is always stored big-endian within the struct, but this accessor returns host order.
impl<'_> IpDiscoveryPacket<'_>
[src]
pub const fn const_packet_size() -> usize
[src]
Standard packet length when using Discord-specified lengths.
Trait Implementations
impl<'p> Debug for IpDiscoveryPacket<'p>
[src]
impl<'p> FromPacket for IpDiscoveryPacket<'p>
[src]
type T = IpDiscovery
The type of the packet to convert from.
fn from_packet(&self) -> IpDiscovery
[src]
impl<'a> Packet for IpDiscoveryPacket<'a>
[src]
impl<'a> PacketSize for IpDiscoveryPacket<'a>
[src]
fn packet_size(&self) -> usize
[src]
impl<'p> PartialEq<IpDiscoveryPacket<'p>> for IpDiscoveryPacket<'p>
[src]
fn eq(&self, other: &IpDiscoveryPacket<'p>) -> bool
[src]
fn ne(&self, other: &IpDiscoveryPacket<'p>) -> bool
[src]
impl<'p> StructuralPartialEq for IpDiscoveryPacket<'p>
[src]
Auto Trait Implementations
impl<'p> RefUnwindSafe for IpDiscoveryPacket<'p>
impl<'p> Send for IpDiscoveryPacket<'p>
impl<'p> Sync for IpDiscoveryPacket<'p>
impl<'p> Unpin for IpDiscoveryPacket<'p>
impl<'p> UnwindSafe for IpDiscoveryPacket<'p>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,