pub struct ReplayWindow { /* private fields */ }Expand description
A wide sliding replay window over a monotonic u64 counter using a circular word ring.
Implementations§
Source§impl ReplayWindow
impl ReplayWindow
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a replay window with the default HighThroughput profile (16 KB / 131,072 bits).
Sourcepub fn new_with_profile(profile: ReplayProfile) -> Self
pub fn new_with_profile(profile: ReplayProfile) -> Self
Create a replay window configured with a specific sizing profile.
Sourcepub fn profile(&self) -> ReplayProfile
pub fn profile(&self) -> ReplayProfile
Current sizing profile of the replay window.
Sourcepub fn promote_to_high_throughput(&mut self)
pub fn promote_to_high_throughput(&mut self)
Dynamically promote window capacity to HighThroughput (16 KB / 131,072 bits).
Preserves all previously seen counters without dropping replay protection.
Sourcepub fn check(&self, counter: u64) -> bool
pub fn check(&self, counter: u64) -> bool
Would counter be accepted right now? Read-only — does not mutate state.
Sourcepub fn commit(&mut self, counter: u64)
pub fn commit(&mut self, counter: u64)
Record counter as seen, advancing the window. Must be preceded by check().
Sourcepub fn check_and_set(&mut self, counter: u64) -> bool
pub fn check_and_set(&mut self, counter: u64) -> bool
Convenience helper to check and commit a counter in one step. Used by test harnesses and benchmark suites.
Trait Implementations§
Source§impl Clone for ReplayWindow
impl Clone for ReplayWindow
Auto Trait Implementations§
impl Freeze for ReplayWindow
impl RefUnwindSafe for ReplayWindow
impl Send for ReplayWindow
impl Sync for ReplayWindow
impl Unpin for ReplayWindow
impl UnsafeUnpin for ReplayWindow
impl UnwindSafe for ReplayWindow
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