pub struct PacketRef<'a> { /* private fields */ }Expand description
A generic packet, not parsed as any particular payload type.
This only interprets the leading four bytes:
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P| | PT | length |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+Implementations§
Source§impl<'a> PacketRef<'a>
impl<'a> PacketRef<'a>
Sourcepub fn parse(buf: &'a [u8]) -> Result<(Self, &'a [u8]), String>
pub fn parse(buf: &'a [u8]) -> Result<(Self, &'a [u8]), String>
Parses a buffer into this packet and rest, doing only basic validation of the version, padding, and length.
Sourcepub fn payload_type(&self) -> u8
pub fn payload_type(&self) -> u8
Returns the uninterpreted payload type of this RTCP packet.
Sourcepub fn as_typed(self) -> Result<Option<TypedPacketRef<'a>>, String>
pub fn as_typed(self) -> Result<Option<TypedPacketRef<'a>>, String>
Parses to a TypedPacketRef if the payload type is supported.
Sourcepub fn as_sender_report(self) -> Result<Option<SenderReportRef<'a>>, String>
pub fn as_sender_report(self) -> Result<Option<SenderReportRef<'a>>, String>
Parses as a sender report, if the type matches.
Sourcepub fn has_padding(&self) -> bool
pub fn has_padding(&self) -> bool
Returns true iff this packet has padding.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for PacketRef<'a>
impl<'a> RefUnwindSafe for PacketRef<'a>
impl<'a> Send for PacketRef<'a>
impl<'a> Sync for PacketRef<'a>
impl<'a> Unpin for PacketRef<'a>
impl<'a> UnsafeUnpin for PacketRef<'a>
impl<'a> UnwindSafe for PacketRef<'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