pub struct RateLimitService { /* private fields */ }Expand description
速率限制服务
Implementations§
Source§impl RateLimitService
impl RateLimitService
Sourcepub fn new(config: RateLimitConfig) -> Self
pub fn new(config: RateLimitConfig) -> Self
Sourcepub async fn check_and_record(&self, key: RateLimitKey) -> RateLimitResult<()>
pub async fn check_and_record(&self, key: RateLimitKey) -> RateLimitResult<()>
Sourcepub async fn reset(&self, key: &RateLimitKey)
pub async fn reset(&self, key: &RateLimitKey)
Sourcepub async fn get_count(&self, key: &RateLimitKey) -> u32
pub async fn get_count(&self, key: &RateLimitKey) -> u32
Sourcepub fn config(&self) -> &RateLimitConfig
pub fn config(&self) -> &RateLimitConfig
获取配置
Trait Implementations§
Source§impl Clone for RateLimitService
impl Clone for RateLimitService
Source§fn clone(&self) -> RateLimitService
fn clone(&self) -> RateLimitService
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RateLimitService
impl Debug for RateLimitService
Auto Trait Implementations§
impl Freeze for RateLimitService
impl !RefUnwindSafe for RateLimitService
impl Send for RateLimitService
impl Sync for RateLimitService
impl Unpin for RateLimitService
impl UnsafeUnpin for RateLimitService
impl !UnwindSafe for RateLimitService
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