pub struct TimeWindow {
pub count: usize,
pub time_unit: TimeUnit,
}Expand description
Represents a time window for rate limiting constraints.
This type enables flexible expression of time windows in rate limits:
TimeUnit- defaults to 1 unit (e.g.,TimeUnit::Daysmeans 1 day)(usize, TimeUnit)- explicit count (e.g.,(7, TimeUnit::Days)means 7 days)Duration- converted to best matching TimeUnit
Fields§
§count: usize§time_unit: TimeUnitTrait Implementations§
Source§impl Clone for TimeWindow
impl Clone for TimeWindow
Source§fn clone(&self) -> TimeWindow
fn clone(&self) -> TimeWindow
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for TimeWindow
Source§impl Debug for TimeWindow
impl Debug for TimeWindow
impl Eq for TimeWindow
Source§impl From<TimeDelta> for TimeWindow
impl From<TimeDelta> for TimeWindow
Source§impl From<TimeUnit> for TimeWindow
impl From<TimeUnit> for TimeWindow
Source§impl PartialEq for TimeWindow
impl PartialEq for TimeWindow
Source§fn eq(&self, other: &TimeWindow) -> bool
fn eq(&self, other: &TimeWindow) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TimeWindow
Auto Trait Implementations§
impl Freeze for TimeWindow
impl RefUnwindSafe for TimeWindow
impl Send for TimeWindow
impl Sync for TimeWindow
impl Unpin for TimeWindow
impl UnsafeUnpin for TimeWindow
impl UnwindSafe for TimeWindow
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