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§
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new rate limit info (currently returns placeholder data)
§Note
This is a placeholder implementation. In a real implementation, this would track actual rate limit headers from API responses. For now, it provides the interface for explicit rate limit information access without automatic behavior.
Sourcepub fn remaining_requests(&self) -> u32
pub fn remaining_requests(&self) -> u32
Get remaining requests in current window
Sourcepub fn total_limit(&self) -> u32
pub fn total_limit(&self) -> u32
Get total rate limit for current window
Sourcepub fn reset_time(&self) -> Option<SystemTime>
pub fn reset_time(&self) -> Option<SystemTime>
Get time when rate limit window resets
Sourcepub fn window_duration(&self) -> Duration
pub fn window_duration(&self) -> Duration
Get duration of rate limit window
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn usage_percentage(&self) -> f64
pub fn usage_percentage(&self) -> f64
Calculate usage percentage (0.0 to 1.0)
Sourcepub fn is_approaching_limit_with_threshold(
&self,
threshold_percentage: f64,
) -> bool
pub fn is_approaching_limit_with_threshold( &self, threshold_percentage: f64, ) -> bool
Sourcepub 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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RateLimitInfo
impl Debug for RateLimitInfo
Auto Trait Implementations§
impl Freeze for RateLimitInfo
impl RefUnwindSafe for RateLimitInfo
impl Send for RateLimitInfo
impl Sync for RateLimitInfo
impl Unpin for RateLimitInfo
impl UnsafeUnpin 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