pub struct Quota {
pub burst: u32,
/* private fields */
}Expand description
A rate limit quota expressed in the GCRA style.
Fields§
§burst: u32Maximum burst size.
Implementations§
Source§impl Quota
impl Quota
Sourcepub fn per_second(n: u32) -> Self
pub fn per_second(n: u32) -> Self
Allow n requests per second.
Sourcepub fn per_minute(n: u32) -> Self
pub fn per_minute(n: u32) -> Self
Allow n requests per minute.
Sourcepub fn allow_burst(self, burst: u32) -> Self
pub fn allow_burst(self, burst: u32) -> Self
Override the burst (token bucket) capacity.
Sourcepub fn from_parts(interval: Duration, burst: u32) -> Self
pub fn from_parts(interval: Duration, burst: u32) -> Self
Create a quota with a custom interval and burst size.
interval is the minimum time between allowed requests.
burst is the maximum number of requests that can be made in rapid succession.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Quota
impl RefUnwindSafe for Quota
impl Send for Quota
impl Sync for Quota
impl Unpin for Quota
impl UnsafeUnpin for Quota
impl UnwindSafe for Quota
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