[][src]Struct bouncer::Bouncer

pub struct Bouncer<'a> {
    pub key: u8,
    pub rate_limit: u8,
    pub wait_time: u8,
    pub block: &'a dyn Fn(),
}

Fields

key: u8rate_limit: u8wait_time: u8block: &'a dyn Fn()

Implementations

impl<'a> Bouncer<'a>[src]

pub fn new(block: &'a dyn Fn()) -> Bouncer<'_>[src]

Returns a Bouncer instance

Arguments

  • block - A block or a function that will execute a request to a third-party service.

pub fn key(&'a mut self, key: u8) -> &'a mut Bouncer<'_>[src]

Assigns a key to the process to be executed.

Arguments

  • key - A integer to identify the process.

pub fn rate_limit(&'a mut self, rate_limit: u8) -> &'a mut Bouncer<'_>[src]

Assigns a rate limit to the process to be executed.

Arguments

  • rate_limit - limit the number of calls.

pub fn wait_time(&'a mut self, wait_time: u8) -> &'a mut Bouncer<'_>[src]

Assigns a waiting time to the process to be executed.

Arguments

  • wait_time - A value in seconds to wait until the next request to be executed.

pub fn run(&self) -> RedisResult<BouncerStats>[src]

Executes the passed block.

Trait Implementations

impl<'a> Clone for Bouncer<'a>[src]

impl<'a> Default for Bouncer<'a>[src]

fn default() -> Bouncer<'a>[src]

Default values for a Bouncer instance.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Bouncer<'a>

impl<'a> !Send for Bouncer<'a>

impl<'a> !Sync for Bouncer<'a>

impl<'a> Unpin for Bouncer<'a>

impl<'a> !UnwindSafe for Bouncer<'a>

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.