Struct ratelimit_meter::state::keyed::Builder
source · pub struct Builder<K: Eq + Hash + Clone, A: Algorithm, H: BuildHasher> { /* private fields */ }
Expand description
A constructor for keyed rate limiters.
Implementations
sourceimpl<K, A, H> Builder<K, A, H>where
K: Eq + Hash + Clone,
A: Algorithm,
H: BuildHasher,
impl<K, A, H> Builder<K, A, H>where
K: Eq + Hash + Clone,
A: Algorithm,
H: BuildHasher,
sourcepub fn with_hasher<H2: BuildHasher>(self, hash_builder: H2) -> Builder<K, A, H2>
pub fn with_hasher<H2: BuildHasher>(self, hash_builder: H2) -> Builder<K, A, H2>
Sets the hashing method used for the map.
sourcepub fn with_cell_weight(
self,
cell_weight: NonZeroU32
) -> Result<Self, InconsistentCapacity>
pub fn with_cell_weight(
self,
cell_weight: NonZeroU32
) -> Result<Self, InconsistentCapacity>
Sets the “weight” of each cell that is checked against the bucket.
sourcepub fn with_map_capacity(self, map_capacity: usize) -> Self
pub fn with_map_capacity(self, map_capacity: usize) -> Self
Sets the initial number of keys that the map can hold before rehashing.
sourcepub fn build(self) -> Result<KeyedRateLimiter<K, A, H>, InconsistentCapacity>where
H: Clone,
pub fn build(self) -> Result<KeyedRateLimiter<K, A, H>, InconsistentCapacity>where
H: Clone,
Constructs a keyed rate limiter with the given options.
Trait Implementations
Auto Trait Implementations
impl<K, A, H> RefUnwindSafe for Builder<K, A, H>where
A: RefUnwindSafe,
H: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, A, H> Send for Builder<K, A, H>where
H: Send,
K: Send,
impl<K, A, H> Sync for Builder<K, A, H>where
H: Sync,
K: Sync,
impl<K, A, H> Unpin for Builder<K, A, H>where
A: Unpin,
H: Unpin,
K: Unpin,
impl<K, A, H> UnwindSafe for Builder<K, A, H>where
A: UnwindSafe,
H: UnwindSafe,
K: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more