pub struct RateLimitLayer { /* private fields */ }Expand description
Token-bucket rate limiter: capacity tokens refilling over window.
Implementations§
Source§impl RateLimitLayer
impl RateLimitLayer
Sourcepub fn token_bucket(capacity: u64, window: Duration) -> RateLimitLayer
pub fn token_bucket(capacity: u64, window: Duration) -> RateLimitLayer
capacity tokens that fully refill over window.
e.g. token_bucket(60_000, Duration::from_secs(60)) ≈ 60k tokens/min.
Trait Implementations§
Source§impl Clone for RateLimitLayer
impl Clone for RateLimitLayer
Source§fn clone(&self) -> RateLimitLayer
fn clone(&self) -> RateLimitLayer
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 RateLimitLayer
Source§impl Debug for RateLimitLayer
impl Debug for RateLimitLayer
Auto Trait Implementations§
impl Freeze for RateLimitLayer
impl RefUnwindSafe for RateLimitLayer
impl Send for RateLimitLayer
impl Sync for RateLimitLayer
impl Unpin for RateLimitLayer
impl UnsafeUnpin for RateLimitLayer
impl UnwindSafe for RateLimitLayer
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