Struct ratelimit_meter::Threadsafe
[−]
[src]
pub struct Threadsafe<Impl> where
Impl: Sized,
Impl: Clone, { /* fields omitted */ }
A wrapper that ensures operations in otherwise thread-unsafe
rate-limiting decision algorithms are thread-safe.
This is implemented by wrapping the actual Decider implementation
in an atomically reference-counted mutex. It takes out a mutex
whenever .test_and_update()
is called.
Trait Implementations
impl<Impl: Clone> Clone for Threadsafe<Impl> where
Impl: Sized,
Impl: Clone,
[src]
Impl: Sized,
Impl: Clone,
fn clone(&self) -> Threadsafe<Impl>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<Impl> DeciderImpl for Threadsafe<Impl> where
Impl: Decider,
Impl: Sized,
Impl: Clone,
[src]
Impl: Decider,
Impl: Sized,
Impl: Clone,
type T = Impl::T
The (optional) type for additional information on negative decisions. Read more
fn test_and_update(&mut self, at: Instant) -> Result<Decision<Impl::T>>
[src]
Tests if a single cell can be accomodated in the rate limiter at the instant at
and updates the rate-limiter to account for the weight of the cell. Read more
fn build_with(l: &Limiter) -> Result<Self>
[src]
Converts the limiter builder into a concrete decider structure.
impl<Impl> Decider for Threadsafe<Impl> where
Impl: Decider,
Impl: Sized,
Impl: Clone,
[src]
Impl: Decider,
Impl: Sized,
Impl: Clone,