[][src]Struct discortp::discord::IpDiscoveryPacket

pub struct IpDiscoveryPacket<'p> { /* fields omitted */ }

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.

impl<'a> Packet for IpDiscoveryPacket<'a>[src]

impl<'a> PacketSize for IpDiscoveryPacket<'a>[src]

impl<'p> PartialEq<IpDiscoveryPacket<'p>> for IpDiscoveryPacket<'p>[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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.