Struct limitador::RateLimiter
source · pub struct RateLimiter { /* private fields */ }
Implementations§
source§impl RateLimiter
impl RateLimiter
pub fn new(cache_size: u64) -> Self
pub fn new_with_storage(counters: Box<dyn CounterStorage>) -> Self
pub fn get_namespaces(&self) -> HashSet<Namespace>
pub fn add_limit(&self, limit: Limit) -> bool
pub fn delete_limit(&self, limit: &Limit) -> Result<(), LimitadorError>
pub fn get_limits(&self, namespace: &Namespace) -> HashSet<Limit>
pub fn delete_limits(&self, namespace: &Namespace) -> Result<(), LimitadorError>
pub fn is_rate_limited( &self, namespace: &Namespace, values: &HashMap<String, String>, delta: i64 ) -> Result<bool, LimitadorError>
pub fn update_counters( &self, namespace: &Namespace, values: &HashMap<String, String>, delta: i64 ) -> Result<(), LimitadorError>
pub fn check_rate_limited_and_update( &self, namespace: &Namespace, values: &HashMap<String, String>, delta: i64, load_counters: bool ) -> Result<CheckResult, LimitadorError>
pub fn get_counters( &self, namespace: &Namespace ) -> Result<HashSet<Counter>, LimitadorError>
pub fn configure_with( &self, limits: impl IntoIterator<Item = Limit> ) -> Result<(), LimitadorError>
Auto Trait Implementations§
impl !Freeze for RateLimiter
impl !RefUnwindSafe for RateLimiter
impl Send for RateLimiter
impl Sync for RateLimiter
impl Unpin for RateLimiter
impl !UnwindSafe for RateLimiter
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more