pub struct Sequence(/* private fields */);Expand description
A monotonic sequence number with wrapping u32 arithmetic.
Implementations§
Source§impl Sequence
impl Sequence
Sourcepub const fn advance(self, n: u32) -> Self
pub const fn advance(self, n: u32) -> Self
Advance the sequence number by n, wrapping at u32::MAX.
Sourcepub const fn is_exactly_acked_by(self, acked: u32) -> bool
pub const fn is_exactly_acked_by(self, acked: u32) -> bool
Returns true if acked is exactly equal to this sequence under
wrapping arithmetic. Equivalent to acked == self.value(), but
the explicit form documents intent.
Sourcepub const fn is_at_least_acked_by(self, acked: u32) -> bool
pub const fn is_at_least_acked_by(self, acked: u32) -> bool
Returns true if acked is at least this sequence — i.e. the
receiver has acknowledged this sequence or any newer one — under
wrapping arithmetic per RFC 1982.
“At least” is interpreted on the half-circle: acked is at least
self iff (acked - self) mod 2^32 < 2^31. This means the
comparison is well-defined as long as the two values are within
2^31 of each other on the wire — far larger than any plausible
in-flight window.
Trait Implementations§
impl Copy for Sequence
impl Eq for Sequence
impl StructuralPartialEq for Sequence
Auto Trait Implementations§
impl Freeze for Sequence
impl RefUnwindSafe for Sequence
impl Send for Sequence
impl Sync for Sequence
impl Unpin for Sequence
impl UnsafeUnpin for Sequence
impl UnwindSafe for Sequence
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