pub struct RateLimitDecision { /* private fields */ }Expand description
Outcome of a rate-limit evaluation with exact nanosecond reset and retry timings.
Implementations§
Source§impl RateLimitDecision
Accessors and tuple/duration conversions for RateLimitDecision.
impl RateLimitDecision
Accessors and tuple/duration conversions for RateLimitDecision.
Sourcepub fn new(
allowed: bool,
remaining: u64,
reset_after_ns: u64,
retry_after_ns: u64,
limit: u64,
) -> Self
pub fn new( allowed: bool, remaining: u64, reset_after_ns: u64, retry_after_ns: u64, limit: u64, ) -> Self
Constructs a new RateLimitDecision.
§Arguments
bool- Whether the request was allowed.u64- Remaining quota after evaluation.u64- Nanoseconds until full quota reset/refill.u64- Nanoseconds until the request may be retried.u64- Configured burst or window limit.
Sourcepub fn get_allowed(&self) -> bool
pub fn get_allowed(&self) -> bool
Sourcepub fn is_allowed(&self) -> bool
pub fn is_allowed(&self) -> bool
Sourcepub fn get_remaining(&self) -> u64
pub fn get_remaining(&self) -> u64
Sourcepub fn get_reset_after_ns(&self) -> u64
pub fn get_reset_after_ns(&self) -> u64
Sourcepub fn get_retry_after_ns(&self) -> u64
pub fn get_retry_after_ns(&self) -> u64
Sourcepub fn reset_after(&self) -> Duration
pub fn reset_after(&self) -> Duration
Sourcepub fn retry_after(&self) -> Duration
pub fn retry_after(&self) -> Duration
Trait Implementations§
Source§impl Clone for RateLimitDecision
impl Clone for RateLimitDecision
impl Copy for RateLimitDecision
Source§impl Debug for RateLimitDecision
impl Debug for RateLimitDecision
impl Eq for RateLimitDecision
Source§impl Hash for RateLimitDecision
impl Hash for RateLimitDecision
Source§impl PartialEq for RateLimitDecision
impl PartialEq for RateLimitDecision
impl StructuralPartialEq for RateLimitDecision
Auto Trait Implementations§
impl Forget for RateLimitDecision
impl Freeze for RateLimitDecision
impl Move for RateLimitDecision
impl RefUnwindSafe for RateLimitDecision
impl Send for RateLimitDecision
impl Sync for RateLimitDecision
impl Unpin for RateLimitDecision
impl UnsafeUnpin for RateLimitDecision
impl UnwindSafe for RateLimitDecision
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