pub struct CounterWindow { /* private fields */ }Expand description
The message reception state for one peer or session (§4.6.5.1).
Eight octets: the largest counter seen, and a bitmap of the 32 before it. Bit 0 stands
for max - 1, bit 1 for max - 2, and so on.
Implementations§
Source§impl CounterWindow
impl CounterWindow
Sourcepub const fn new(kind: CounterKind) -> Self
pub const fn new(kind: CounterKind) -> Self
An empty window that will accept the first counter it sees.
Sourcepub const fn primed_at(kind: CounterKind, max: u32) -> Self
pub const fn primed_at(kind: CounterKind, max: u32) -> Self
A window that has already seen max and nothing before it.
This is how a session resumed from storage starts: the counter it left off at is known, the 32 before it are not, so they are treated as already seen — which is the safe direction.
Sourcepub const fn kind(&self) -> CounterKind
pub const fn kind(&self) -> CounterKind
Which rule this window applies.
Sourcepub fn accept(&mut self, counter: u32) -> Verdict
pub fn accept(&mut self, counter: u32) -> Verdict
Judges counter, and records it when it is new.
Sourcepub fn would_accept(&self, counter: u32) -> Verdict
pub fn would_accept(&self, counter: u32) -> Verdict
Whether counter would be accepted, without recording it.
Trait Implementations§
Source§impl Clone for CounterWindow
impl Clone for CounterWindow
impl Copy for CounterWindow
Source§impl Debug for CounterWindow
impl Debug for CounterWindow
impl Eq for CounterWindow
Source§impl PartialEq for CounterWindow
impl PartialEq for CounterWindow
impl StructuralPartialEq for CounterWindow
Auto Trait Implementations§
impl Forget for CounterWindow
impl Freeze for CounterWindow
impl Move for CounterWindow
impl RefUnwindSafe for CounterWindow
impl Send for CounterWindow
impl Sync for CounterWindow
impl Unpin for CounterWindow
impl UnsafeUnpin for CounterWindow
impl UnwindSafe for CounterWindow
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