[][src]Struct ratelimit_meter::state::keyed::Builder

pub struct Builder<K: Eq + Hash + Clone, C: Clock, A: Algorithm<C::Instant>, H: BuildHasher> { /* fields omitted */ }

A constructor for keyed rate limiters.

Methods

impl<K, C, A, H> Builder<K, C, A, H> where
    K: Eq + Hash + Clone,
    C: Clock,
    A: Algorithm<C::Instant>,
    A::BucketState: KeyableRateLimitState<A, C::Instant>,
    H: BuildHasher
[src]

pub fn with_hasher<H2: BuildHasher>(
    self,
    hash_builder: H2
) -> Builder<K, C, A, H2>
[src]

Sets the hashing method used for the map.

pub fn with_cell_weight(
    self,
    cell_weight: NonZeroU32
) -> Result<Self, InconsistentCapacity>
[src]

Sets the "weight" of each cell that is checked against the bucket.

pub fn with_map_capacity(self, map_capacity: usize) -> Self[src]

Sets the initial number of keys that the map can hold before rehashing.

pub fn using_clock(self, clock: C) -> Self[src]

Sets the clock used by the bucket.

pub fn build(self) -> Result<KeyedRateLimiter<K, A, C, H>, InconsistentCapacity> where
    H: Clone
[src]

Constructs a keyed rate limiter with the given options.

Trait Implementations

impl<K, A, C> Default for Builder<K, C, A, RandomState> where
    K: Eq + Hash + Clone,
    C: Clock,
    A: Algorithm<C::Instant>,
    A::BucketState: KeyableRateLimitState<A, C::Instant>, 
[src]

Auto Trait Implementations

impl<K, C, A, H> Send for Builder<K, C, A, H> where
    C: Send,
    H: Send,
    K: Send

impl<K, C, A, H> Sync for Builder<K, C, A, H> where
    C: Sync,
    H: Sync,
    K: Sync

impl<K, C, A, H> Unpin for Builder<K, C, A, H> where
    A: Unpin,
    C: Unpin,
    H: Unpin,
    K: Unpin

impl<K, C, A, H> RefUnwindSafe for Builder<K, C, A, H> where
    A: RefUnwindSafe,
    C: RefUnwindSafe,
    H: RefUnwindSafe,
    K: RefUnwindSafe

impl<K, C, A, H> UnwindSafe for Builder<K, C, A, H> where
    A: UnwindSafe,
    C: UnwindSafe,
    H: UnwindSafe,
    K: UnwindSafe

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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