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

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

A constructor for keyed rate limiters.

Methods

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

pub fn with_hasher<H2: BuildHasher>(
    self,
    hash_builder: H2
) -> Builder<K, P, 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 build(self) -> Result<KeyedRateLimiter<K, A, P, H>, InconsistentCapacity> where
    H: Clone
[src]

Constructs a keyed rate limiter with the given options.

Trait Implementations

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

Auto Trait Implementations

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

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

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> Any for T where
    T: 'static + ?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> Erased for T