Struct ratelimit_meter::example_algorithms::Allower
[−]
[src]
pub struct Allower {}
The most naive implementation of a rate-limiter ever: Always allows every cell through.
Example
use ratelimit_meter::{Decider}; use ratelimit_meter::example_algorithms::Allower; let mut allower = Allower::new(); assert!(allower.check().unwrap().is_compliant());
Methods
impl Allower
[src]
Trait Implementations
impl Decider for Allower
[src]
fn check(&mut self) -> Result<Decision<Self::T>>
[src]
Tests if a single cell can be accomodated at Instant::now()
. See check_at
. Read more
fn check_at(&mut self, at: Instant) -> Result<Decision<Self::T>>
[src]
Tests is a single cell can be accomodated at the given time stamp. Read more
impl MultiDecider for Allower
[src]
fn check_n_at(&mut self, n: u32, at: Instant) -> Result<Decision<Self::T>>
[src]
Tests if n
cells can be accomodated at the given time stamp. An error ErrorKind::InsufficientCapacity
is returned if n
exceeds the bucket capacity. Read more
fn check_n(&mut self, n: u32) -> Result<Decision<Self::T>>
[src]
Tests if n
cells can be accomodated at the current time (Instant::now()
). An error ErrorKind::InsufficientCapacity
is returned if n
exceeds the bucket capacity. Read more
impl Copy for Allower
[src]
impl Clone for Allower
[src]
fn clone(&self) -> Allower
[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