pub struct CodingPlanQuotaSummary {Show 14 fields
pub kind: CodingPlanQuotaKind,
pub type_: String,
pub unit: Option<String>,
pub number: u64,
pub reported_usage: Option<u64>,
pub current_value: Option<u64>,
pub reported_remaining: Option<u64>,
pub quota: u64,
pub used: u64,
pub remaining: u64,
pub percentage: f64,
pub next_reset_time: Option<String>,
pub next_reset_at: Option<DateTime<Utc>>,
pub usage_details: Vec<CodingPlanUsageDetail>,
}Expand description
Easy-to-use quota-window view derived from CodingPlanQuotaLimit.
This hides wire-format quirks such as currentValue, numeric unit, and
millisecond nextResetTime, while preserving the raw strings for display or
debugging when needed.
Fields§
§kind: CodingPlanQuotaKindNormalized quota kind.
type_: StringRaw API type string.
unit: Option<String>Raw API unit normalized to a string.
number: u64Raw number value reported by the API.
reported_usage: Option<u64>Raw usage value reported by the API, when present.
current_value: Option<u64>Raw currentValue value reported by the API, when present.
reported_remaining: Option<u64>Raw remaining value reported by the API, when present.
quota: u64Total quota amount.
used: u64Consumed amount in the current window.
remaining: u64Remaining amount in the current window.
percentage: f64Consumed percentage reported by the API.
next_reset_time: Option<String>Raw reset value normalized to a string.
next_reset_at: Option<DateTime<Utc>>Parsed reset time in UTC when the raw value is a Unix timestamp or RFC3339.
usage_details: Vec<CodingPlanUsageDetail>Optional per-model breakdown.
Implementations§
Source§impl CodingPlanQuotaSummary
impl CodingPlanQuotaSummary
Sourcepub fn is_time_limit(&self) -> bool
pub fn is_time_limit(&self) -> bool
True when this is the per-5-hour window.
Sourcepub fn is_tokens_limit(&self) -> bool
pub fn is_tokens_limit(&self) -> bool
True when this is the weekly tokens window.
Sourcepub fn used_ratio(&self) -> f64
pub fn used_ratio(&self) -> f64
Consumed fraction in [0.0, 1.0].
Sourcepub fn usage_for_model(&self, model_code: &str) -> Option<u64>
pub fn usage_for_model(&self, model_code: &str) -> Option<u64>
Return the usage attributed to one model code, if present.
Sourcepub fn next_reset_at_beijing(&self) -> Option<DateTime<FixedOffset>>
pub fn next_reset_at_beijing(&self) -> Option<DateTime<FixedOffset>>
Parsed reset time in UTC+08:00 (Beijing / Shanghai fixed offset).
Trait Implementations§
Source§impl Clone for CodingPlanQuotaSummary
impl Clone for CodingPlanQuotaSummary
Source§fn clone(&self) -> CodingPlanQuotaSummary
fn clone(&self) -> CodingPlanQuotaSummary
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CodingPlanQuotaSummary
impl Debug for CodingPlanQuotaSummary
Auto Trait Implementations§
impl Freeze for CodingPlanQuotaSummary
impl RefUnwindSafe for CodingPlanQuotaSummary
impl Send for CodingPlanQuotaSummary
impl Sync for CodingPlanQuotaSummary
impl Unpin for CodingPlanQuotaSummary
impl UnsafeUnpin for CodingPlanQuotaSummary
impl UnwindSafe for CodingPlanQuotaSummary
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.