pub struct RateLimiter { /* private fields */ }Expand description
Sliding-window rate limiter per tool.
Implementations§
Source§impl RateLimiter
impl RateLimiter
pub fn new(default_limit: RateLimit) -> Self
pub fn set_limit( &mut self, tool_name: impl Into<CompactString>, limit: RateLimit, )
pub fn limit_count(&self) -> usize
Sourcepub fn set_time(&mut self, now_ms: u64)
pub fn set_time(&mut self, now_ms: u64)
Must be called before each check to provide current time.
pub fn check(&mut self, call: &ToolCall) -> Option<GovernanceVerdict>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RateLimiter
impl RefUnwindSafe for RateLimiter
impl Send for RateLimiter
impl Sync for RateLimiter
impl Unpin for RateLimiter
impl UnsafeUnpin 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