pub struct RateLimitInfo {
pub limit_requests: Option<u64>,
pub limit_tokens: Option<u64>,
pub remaining_requests: Option<u64>,
pub remaining_tokens: Option<u64>,
pub reset_requests: Option<String>,
pub reset_tokens: Option<String>,
}Expand description
Rate limit information extracted from Groq response headers.
Fields§
§limit_requests: Option<u64>Maximum requests allowed per window.
limit_tokens: Option<u64>Maximum tokens allowed per window.
remaining_requests: Option<u64>Remaining requests in the current window.
remaining_tokens: Option<u64>Remaining tokens in the current window.
reset_requests: Option<String>Time until the request limit resets (e.g., “1s”, “6m0s”).
reset_tokens: Option<String>Time until the token limit resets.
Implementations§
Source§impl RateLimitInfo
impl RateLimitInfo
Sourcepub fn from_headers(headers: &[(String, String)]) -> Self
pub fn from_headers(headers: &[(String, String)]) -> Self
Parse rate limit info from HTTP response headers.
Groq returns these headers:
x-ratelimit-limit-requestsx-ratelimit-limit-tokensx-ratelimit-remaining-requestsx-ratelimit-remaining-tokensx-ratelimit-reset-requestsx-ratelimit-reset-tokens
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 Default for RateLimitInfo
impl Default for RateLimitInfo
Source§fn default() -> RateLimitInfo
fn default() -> RateLimitInfo
Returns the “default value” for a type. 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