pub struct RestRateLimiter { /* private fields */ }Implementations§
Source§impl RestRateLimiter
impl RestRateLimiter
pub fn new() -> Self
pub fn new_with_budget(max_weight: u32) -> Self
Sourcepub async fn acquire(&self, weight: u32) -> Result<(), RateLimitError>
pub async fn acquire(&self, weight: u32) -> Result<(), RateLimitError>
Returns Err(RateLimitError) immediately if the weight budget is exhausted.
Sourcepub async fn acquire_blocking(&self, weight: u32, call: &str)
pub async fn acquire_blocking(&self, weight: u32, call: &str)
Retries on Err, logging each wait. Resolves once the request is accepted.
Sourcepub async fn budget_snapshot(&self) -> (u32, u32, usize)
pub async fn budget_snapshot(&self) -> (u32, u32, usize)
T4 (2026-09-30): current snapshot of the sliding window —
(remaining_weight, max_weight, used_entries). Lets the host
application export the info-budget water level as a telemetry
gauge (exhaustion becomes a queryable trend, not a surprise).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RestRateLimiter
impl !RefUnwindSafe for RestRateLimiter
impl Send for RestRateLimiter
impl Sync for RestRateLimiter
impl Unpin for RestRateLimiter
impl UnsafeUnpin for RestRateLimiter
impl UnwindSafe for RestRateLimiter
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