pub struct SeqNo(/* private fields */);
Expand description
Sequence number of an RTP packet.
An RTP packet is identified by: SSRC + SeqNo. However in the RTP header the sequence number
is a u16
, meaning the value quite quickly “rolls over”. To uniquely identify a packet,
str0m keeps track of the roll overs and converts the u16
to u64
in this SeqNo
.
To get the RTP u16 value from a SeqNo
, use as_u16()
or cast it to u16.
let seq_no: SeqNo = 65_537.into();
// Use `as_u16()`.
let a = seq_no.as_u16();
// Discard upper 48 bits to get RTP u16.
let b = *seq_no as u16;
assert_eq!(a, 1);
assert_eq!(b, 1);
Implementations§
Source§impl SeqNo
impl SeqNo
Sourcepub fn is_next(&self, other: SeqNo) -> bool
pub fn is_next(&self, other: SeqNo) -> bool
Check if the other
sequence number is directly following this.
Sourcepub fn inc(&mut self) -> SeqNo
pub fn inc(&mut self) -> SeqNo
Increase (mutate) this sequence number and return the previous value.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SeqNo
impl<'de> Deserialize<'de> for SeqNo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for SeqNo
impl Ord for SeqNo
Source§impl PartialOrd for SeqNo
impl PartialOrd for SeqNo
impl Copy for SeqNo
impl Eq for SeqNo
impl StructuralPartialEq for SeqNo
Auto Trait Implementations§
impl Freeze for SeqNo
impl RefUnwindSafe for SeqNo
impl Send for SeqNo
impl Sync for SeqNo
impl Unpin for SeqNo
impl UnwindSafe for SeqNo
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