pub struct RateLimitInfo { /* private fields */ }Expand description
Rate limit information for explicit control
§Governing Principle Compliance
This struct follows the “Thin Client, Rich API” principle by:
- Information vs Action: Provides rate limit data without making automatic decisions
- Zero Automatic Behavior: No hidden rate limiting or magic throttling thresholds
- Explicit Control: Developers can use this information to make their own timing decisions
- Transparent Operations: All rate limit metrics are visible and accessible
Implementations§
§impl RateLimitInfo
impl RateLimitInfo
pub fn remaining_requests(&self) -> u32
pub fn remaining_requests(&self) -> u32
Get remaining requests in current window
pub fn total_limit(&self) -> u32
pub fn total_limit(&self) -> u32
Get total rate limit for current window
pub fn reset_time(&self) -> Option<SystemTime>
pub fn reset_time(&self) -> Option<SystemTime>
Get time when rate limit window resets
pub fn window_duration(&self) -> Duration
pub fn window_duration(&self) -> Duration
Get duration of rate limit window
pub fn usage_percentage(&self) -> f64
pub fn usage_percentage(&self) -> f64
Calculate usage percentage (0.0 to 1.0)
pub fn is_approaching_limit_with_threshold(
&self,
threshold_percentage: f64,
) -> bool
pub fn is_approaching_limit_with_threshold( &self, threshold_percentage: f64, ) -> bool
pub fn suggested_delay_for_rate(
&self,
desired_requests_per_minute: u32,
) -> Duration
pub fn suggested_delay_for_rate( &self, desired_requests_per_minute: u32, ) -> Duration
Trait Implementations§
Source§impl Clone for RateLimitInfo
impl Clone for RateLimitInfo
Source§fn clone(&self) -> RateLimitInfo
fn clone(&self) -> RateLimitInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RateLimitInfo
impl RefUnwindSafe for RateLimitInfo
impl Send for RateLimitInfo
impl Sync for RateLimitInfo
impl Unpin for RateLimitInfo
impl UnwindSafe for RateLimitInfo
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