Struct carapax::ratelimit::KeyedRateLimitPredicate
source · pub struct KeyedRateLimitPredicate<K, J, M>where
K: Key,{ /* private fields */ }
Available on crate feature
ratelimit
only.Expand description
A predicate with keyed rate limiter.
Each update will have it’s own rate limit under key K
.
Implementations§
source§impl<K, J, M> KeyedRateLimitPredicate<K, J, M>where
K: Key,
impl<K, J, M> KeyedRateLimitPredicate<K, J, M>where
K: Key,
source§impl<K> KeyedRateLimitPredicate<K, NoJitter, MethodDiscard>where
K: Key,
impl<K> KeyedRateLimitPredicate<K, NoJitter, MethodDiscard>where
K: Key,
source§impl<K> KeyedRateLimitPredicate<K, NoJitter, MethodWait>where
K: Key,
impl<K> KeyedRateLimitPredicate<K, NoJitter, MethodWait>where
K: Key,
source§impl<K> KeyedRateLimitPredicate<K, Jitter, MethodWait>where
K: Key,
impl<K> KeyedRateLimitPredicate<K, Jitter, MethodWait>where
K: Key,
sourcepub fn wait_with_jitter(quota: Quota, jitter: Jitter) -> Self
pub fn wait_with_jitter(quota: Quota, jitter: Jitter) -> Self
Creates a new KeyedRateLimitPredicate
with wait method and jitter.
Predicate will pause update propagation when the rate limit is reached.
§Arguments
quota
- A rate limiting quota.jitter
- An interval specification for deviating from the nominal wait time.
Trait Implementations§
source§impl<K, J: Clone, M: Clone> Clone for KeyedRateLimitPredicate<K, J, M>
impl<K, J: Clone, M: Clone> Clone for KeyedRateLimitPredicate<K, J, M>
source§fn clone(&self) -> KeyedRateLimitPredicate<K, J, M>
fn clone(&self) -> KeyedRateLimitPredicate<K, J, M>
Returns a copy 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 moresource§impl<K> Handler<K> for KeyedRateLimitPredicate<K, Jitter, MethodWait>
impl<K> Handler<K> for KeyedRateLimitPredicate<K, Jitter, MethodWait>
§type Output = PredicateResult
type Output = PredicateResult
A future output returned by
Self::handle
method. Read moresource§impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodDiscard>
impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodDiscard>
§type Output = PredicateResult
type Output = PredicateResult
A future output returned by
Self::handle
method. Read moresource§impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodWait>
impl<K> Handler<K> for KeyedRateLimitPredicate<K, NoJitter, MethodWait>
§type Output = PredicateResult
type Output = PredicateResult
A future output returned by
Self::handle
method. Read moreAuto Trait Implementations§
impl<K, J, M> Freeze for KeyedRateLimitPredicate<K, J, M>
impl<K, J, M> !RefUnwindSafe for KeyedRateLimitPredicate<K, J, M>
impl<K, J, M> Send for KeyedRateLimitPredicate<K, J, M>
impl<K, J, M> Sync for KeyedRateLimitPredicate<K, J, M>
impl<K, J, M> Unpin for KeyedRateLimitPredicate<K, J, M>
impl<K, J, M> !UnwindSafe for KeyedRateLimitPredicate<K, J, M>
Blanket Implementations§
source§impl<P, H, HI> AccessExt<P, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
impl<P, H, HI> AccessExt<P, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
source§fn with_access_policy(
self,
policy: P
) -> Predicate<AccessPredicate<P>, HandlerInput, Self, HI>
fn with_access_policy( self, policy: P ) -> Predicate<AccessPredicate<P>, HandlerInput, Self, HI>
Available on crate feature
access
only.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
source§impl<H, I> CommandExt<I> for Hwhere
H: Handler<I>,
I: TryFromInput,
impl<H, I> CommandExt<I> for Hwhere
H: Handler<I>,
I: TryFromInput,
source§fn with_command<S: Into<String>>(
self,
name: S
) -> Predicate<CommandPredicate, Command, Self, I>
fn with_command<S: Into<String>>( self, name: S ) -> Predicate<CommandPredicate, Command, Self, I>
Shortcut to create a command handler. Read more
source§impl<P, PI, H, HI, HS> DialogueExt<P, PI, HI, HS> for H
impl<P, PI, H, HI, HS> DialogueExt<P, PI, HI, HS> for H
source§fn with_dialogue<B>(
self,
predicate: P
) -> Predicate<DialoguePredicate<B, P, PI, HS>, HandlerInput, DialogueDecorator<B, Self, HI, HS>, HandlerInput>
fn with_dialogue<B>( self, predicate: P ) -> Predicate<DialoguePredicate<B, P, PI, HS>, HandlerInput, DialogueDecorator<B, Self, HI, HS>, HandlerInput>
Available on crate feature
dialogue
only.source§impl<E, H, HI> ErrorExt<E, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
impl<E, H, HI> ErrorExt<E, HI> for Hwhere
H: Handler<HI>,
HI: TryFromInput,
source§fn on_error(self, error_handler: E) -> ErrorDecorator<E, Self, HI>
fn on_error(self, error_handler: E) -> ErrorDecorator<E, Self, HI>
A shortcut to create a new error decorator. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more