[][src]Struct carapax::ratelimit::RateLimitMiddleware

pub struct RateLimitMiddleware { /* fields omitted */ }

Limits number of updates per time

Methods

impl RateLimitMiddleware[src]

pub fn direct(capacity: NonZeroU32, seconds: u64) -> Self[src]

Limit all updates

Arguments

  • capacity - Number of updates
  • seconds - Duration in seconds

pub fn keyed(
    key: RateLimitKey,
    capacity: NonZeroU32,
    seconds: u64,
    on_missing: bool
) -> Self
[src]

Limit updates for each user or chat

Arguments

  • key - User or Chat
  • capacity - Number of updates
  • seconds - Duration in seconds
  • on_missing - Allow or deny update when user or chat not found (got an update from channel or inline query, etc...)

Trait Implementations

impl<C> Middleware<C> for RateLimitMiddleware[src]

fn after(&mut self, _context: &mut C, _update: &Update) -> MiddlewareFuture[src]

Called after all handlers

Auto Trait Implementations

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T