pub struct RequestRecord {
pub count: u32,
pub window_start: u64,
pub timestamps: Vec<u64>,
}
Fields§
§count: u32
§window_start: u64
§timestamps: Vec<u64>
Implementations§
Source§impl RequestRecord
impl RequestRecord
pub fn new(is_short_interval: bool) -> Self
pub fn add_request(&mut self, is_short_interval: bool, window_size: u64)
pub fn is_limit_exceeded( &self, limit: u32, is_short_interval: bool, window_size: u64, ) -> bool
pub fn memory_usage(&self) -> usize
pub fn should_cleanup(&self, max_age_seconds: u64) -> bool
Trait Implementations§
Source§impl Clone for RequestRecord
impl Clone for RequestRecord
Source§fn clone(&self) -> RequestRecord
fn clone(&self) -> RequestRecord
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for RequestRecord
impl RefUnwindSafe for RequestRecord
impl Send for RequestRecord
impl Sync for RequestRecord
impl Unpin for RequestRecord
impl UnwindSafe for RequestRecord
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