pub struct RateLimit { /* private fields */ }Expand description
Middleware that calls RateLimiter::acquire before each LLM call.
Implementations§
Source§impl RateLimit
impl RateLimit
Sourcepub fn new(limiter: Arc<dyn RateLimiter>) -> Self
pub fn new(limiter: Arc<dyn RateLimiter>) -> Self
Build with a limiter and the default char-count estimator.
Sourcepub fn with_estimator<F>(self, f: F) -> Self
pub fn with_estimator<F>(self, f: F) -> Self
Override the cost estimator (e.g. plug in a real tokenizer).
Trait Implementations§
Source§impl Middleware for RateLimit
impl Middleware for RateLimit
Auto Trait Implementations§
impl Freeze for RateLimit
impl !RefUnwindSafe for RateLimit
impl Send for RateLimit
impl Sync for RateLimit
impl Unpin for RateLimit
impl UnsafeUnpin for RateLimit
impl !UnwindSafe for RateLimit
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