[][src]Struct carapax_ratelimit::KeyedRateLimitHandler

pub struct KeyedRateLimitHandler<K: RateLimitKey> { /* fields omitted */ }

Limits updates accroding to given rules

Methods

impl<K> KeyedRateLimitHandler<K> where
    K: RateLimitKey
[src]

pub fn new(
    key: K,
    on_missing: bool,
    capacity: NonZeroU32,
    duration: Duration
) -> Self
[src]

Creates a new handler

Arguments

  • key - A key to filter updates
  • capacity - Number of updates
  • duration - Per time unit
  • on_missing - Allow or deny update when key is missing

Trait Implementations

impl<K> Handler for KeyedRateLimitHandler<K> where
    K: RateLimitKey
[src]

type Input = Update

An object to handle (update, message, inline query, etc...) Read more

type Output = HandlerResult

A result or future to return Read more

Auto Trait Implementations

impl<K> Send for KeyedRateLimitHandler<K> where
    K: Send,
    <K as RateLimitKey>::Key: Send

impl<K> Sync for KeyedRateLimitHandler<K> where
    K: Sync,
    <K as RateLimitKey>::Key: Send

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Any for T where
    T: Any

impl<T> Erased for T