pub struct InPacket<'a> { /* private fields */ }Implementations§
Source§impl<'a> InPacket<'a>
impl<'a> InPacket<'a>
Sourcepub fn try_new(direction: Direction, data: &'a [u8]) -> Result<Self, Error>
pub fn try_new(direction: Direction, data: &'a [u8]) -> Result<Self, Error>
Do some sanity checks before creating the object.
Sourcepub fn new(direction: Direction, data: &'a [u8]) -> Self
pub fn new(direction: Direction, data: &'a [u8]) -> Self
This method expects that data holds a valid packet.
If not, further function calls may panic.
pub fn header(&self) -> &InHeader<'a>
pub fn content(&self) -> &[u8] ⓘ
Sourcepub fn ack_packet(&self) -> Result<Option<u16>, Error>
pub fn ack_packet(&self) -> Result<Option<u16>, Error>
Get the acknowledged packet id if this is an ack packet.
Sourcepub fn into_audio(self) -> Result<InAudio<'a>, Error>
pub fn into_audio(self) -> Result<InAudio<'a>, Error>
Parse this packet into a voice packet.
Sourcepub fn into_command(self) -> Result<InCommand<'a>, Error>
pub fn into_command(self) -> Result<InCommand<'a>, Error>
Put this packet into a command packet.
pub fn into_s2cinit(self) -> Result<InS2CInit<'a>, Error>
pub fn into_c2sinit(self) -> Result<InC2SInit<'a>, Error>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for InPacket<'a>
impl<'a> RefUnwindSafe for InPacket<'a>
impl<'a> Send for InPacket<'a>
impl<'a> Sync for InPacket<'a>
impl<'a> Unpin for InPacket<'a>
impl<'a> UnwindSafe for InPacket<'a>
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