pub struct Seq(/* private fields */);Expand description
16 bit RTP sequence number value, as obtained from the sequence_number() method of RtpReader.
use rtp_rs::*;
let seq = Seq::from(123);This type’s behavior attempts to honour the expected wrap-around of sequence number values
from 0xffff back to 0x0000.
You can perform logic over sequences of RTP packets using this type and other helpers from this crate,
let start = Seq::from(0xfffe);
let end = Seq::from(0x0002);
// produces the Seq values 0xfffe, 0xffff, 0x0000, 0x0001:
for seq in (start..end).seq_iter() {
// ...inspect some RTP packet you've stored against this sequence number...
}§Unsoundness
Note this type has implementations of Ord and PartialOrd, but those implementations
violate the requirement for transitivity which both traits document.
ⓘ
let a = Seq::from(0);
let b = a + 0x7fff;
let c = b + 0x7fff;
assert!(a < b);
assert!(b < c);
assert!(a < c); // Assertion fails, in violation of Ord/PartialOrd requirementsA future release will potentially deprecate Ord / PartialOrd implementations for Seq, and
hopefully provide a mechanism for sequence number processing which is sound.
Implementations§
Trait Implementations§
impl Copy for Seq
impl Eq for Seq
Source§impl Ord for Seq
impl Ord for Seq
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Seq
impl PartialOrd for Seq
impl StructuralPartialEq for Seq
Auto Trait Implementations§
impl Freeze for Seq
impl RefUnwindSafe for Seq
impl Send for Seq
impl Sync for Seq
impl Unpin for Seq
impl UnsafeUnpin for Seq
impl UnwindSafe for Seq
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