pub struct FixedWindow { /* private fields */ }Expand description
A time window for tracking failures with fixed buckets.
Implementations§
Source§impl FixedWindow
impl FixedWindow
Sourcepub fn new(window_size: Duration, bucket_count: usize) -> Self
pub fn new(window_size: Duration, bucket_count: usize) -> Self
Creates a new fixed window tracker.
Sourcepub fn record_success(&self)
pub fn record_success(&self)
Records a successful call.
Sourcepub fn record_failure(&self)
pub fn record_failure(&self)
Records a failed call.
Sourcepub fn error_rate(&self) -> f64
pub fn error_rate(&self) -> f64
Gets the current error rate in the window.
Auto Trait Implementations§
impl !Freeze for FixedWindow
impl !RefUnwindSafe for FixedWindow
impl Send for FixedWindow
impl Sync for FixedWindow
impl Unpin for FixedWindow
impl UnwindSafe for FixedWindow
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