pub struct RateLimitInfo {
pub requests_remaining: Option<u32>,
pub tokens_remaining: Option<u32>,
pub retry_after_secs: Option<u64>,
pub resets_at: Option<u64>,
pub error_type: Option<String>,
pub message: Option<String>,
}Expand description
Rate limit info extracted from response headers and/or error body.
Fields§
§requests_remaining: Option<u32>Requests remaining in current window.
tokens_remaining: Option<u32>Tokens remaining in current window.
retry_after_secs: Option<u64>Seconds until limit resets.
resets_at: Option<u64>Unix timestamp when limit resets.
error_type: Option<String>Provider error type (e.g. “usage_limit_reached”, “rate_limit_exceeded”).
message: Option<String>Human-readable message from provider.
Implementations§
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn from_headers(headers: &HeaderMap) -> Option<Self>
pub fn from_headers(headers: &HeaderMap) -> Option<Self>
Parse from HTTP response headers (OpenAI/Gemini/OpenRouter standard).
Sourcepub fn from_error_body(body: &str) -> Option<Self>
pub fn from_error_body(body: &str) -> Option<Self>
Parse from JSON error body (OpenAI, Codex, Gemini error responses).
Sourcepub fn reset_display(&self) -> String
pub fn reset_display(&self) -> String
Human-readable description of when limit resets.
Sourcepub fn status_line(&self) -> String
pub fn status_line(&self) -> String
One-line status for status bar.
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 moreSource§impl Debug for RateLimitInfo
impl Debug for RateLimitInfo
Source§impl<'de> Deserialize<'de> for RateLimitInfo
impl<'de> Deserialize<'de> for RateLimitInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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