Skip to main content

AbstractRatelimitEvents

Trait AbstractRatelimitEvents 

Source
pub trait AbstractRatelimitEvents: Sync + Send {
    // Required methods
    fn insert_ratelimit_event<'life0, 'life1, 'async_trait>(
        &'life0 self,
        event: &'life1 RatelimitEvent,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn has_ratelimited<'life0, 'life1, 'async_trait>(
        &'life0 self,
        target_id: &'life1 str,
        event_type: RatelimitEventType,
        period: Duration,
        count: usize,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn insert_ratelimit_event<'life0, 'life1, 'async_trait>( &'life0 self, event: &'life1 RatelimitEvent, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert a new ratelimit event

Source

fn has_ratelimited<'life0, 'life1, 'async_trait>( &'life0 self, target_id: &'life1 str, event_type: RatelimitEventType, period: Duration, count: usize, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count number of events in given duration and check if we’ve hit the limit

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§