pub struct CachedTokenBucket { /* private fields */ }Expand description
Thread-local cached token bucket implementation
Implementations§
Trait Implementations§
Source§impl Algorithm for CachedTokenBucket
impl Algorithm for CachedTokenBucket
Source§fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<RateLimitDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<RateLimitDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Checks if a request for the given key should be permitted. Read more
Source§fn check_with_cost<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
cost: u64,
) -> Pin<Box<dyn Future<Output = Result<RateLimitDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_with_cost<'life0, 'life1, 'async_trait>(
&'life0 self,
key: &'life1 str,
cost: u64,
) -> Pin<Box<dyn Future<Output = Result<RateLimitDecision>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Checks if a request with the given cost should be permitted. Read more
Auto Trait Implementations§
impl Freeze for CachedTokenBucket
impl RefUnwindSafe for CachedTokenBucket
impl Send for CachedTokenBucket
impl Sync for CachedTokenBucket
impl Unpin for CachedTokenBucket
impl UnwindSafe for CachedTokenBucket
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