You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Essentially I want to do this. It's a simple example that doesn't account for the other possible constructors for Quota.
use std::num::NonZeroU32;use nonzero_ext::*;use governor::{Quota,RateLimiter};letmut lim = RateLimiter::direct(Quota::per_second(nonzero!(50u32)));// Allow 50 units per secondassert_eq!(lim.get_quota(), nonzero!(50u32));
The text was updated successfully, but these errors were encountered:
Hah! Fun question. There's no quota accessor on rate-limiters yet, because i haven't found a need for one so far (if you want to provide information to a user being rate-limited, check out the StateInformationMiddleware!)...
I think some janky ways exist to get at a StateSnapshot without the state information middleware, but if all you need is just the literal quota - I guess a thing that works like StateSnapshot::quota would be a great addition. I can probably add this later this week, or I'm happy to apply a PR you submit if you get to it first!
Essentially I want to do this. It's a simple example that doesn't account for the other possible constructors for
Quota
.The text was updated successfully, but these errors were encountered: