Struct rtp_rs::Seq [−][src]
pub struct Seq(_);
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 requirements
A 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 Ord for Seq
[src]
impl Ord for Seq
[src]impl PartialOrd<Seq> for Seq
[src]
impl PartialOrd<Seq> for Seq
[src]fn partial_cmp(&self, other: &Seq) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Seq) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Sub<Seq> for Seq
[src]
impl Sub<Seq> for Seq
[src]Implements wrapped subtraction such that for instance Seq(0x0000) - Seq(0xffff)
results in
1
(rather than -65535
).
This is for symmetry with addition, where for example Seq(0xffff) + 1
gives Seq(0x0000)
impl Copy for Seq
[src]
impl Eq for Seq
[src]
impl StructuralEq for Seq
[src]
impl StructuralPartialEq for Seq
[src]
Auto Trait Implementations
impl RefUnwindSafe for Seq
impl Send for Seq
impl Sync for Seq
impl Unpin for Seq
impl UnwindSafe for Seq
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more