pub struct CodingPlanQuotaLimit {
pub type_: String,
pub unit: Option<String>,
pub number: u64,
pub percentage: f64,
pub usage: Option<u64>,
pub current_value: Option<u64>,
pub remaining: Option<u64>,
pub next_reset_time: Option<String>,
pub usage_details: Vec<CodingPlanUsageDetail>,
}Expand description
One quota window reported by the monitor endpoint.
The Coding Plan applies two kinds of windows, surfaced as TIME_LIMIT
(per-5-hour) and TOKENS_LIMIT (weekly tokens). Depending on the upstream
deployment, each window may include explicit currentValue / remaining /
usage counters, or only a number plus consumed percentage.
Fields§
§type_: StringLimit kind: TIME_LIMIT (5-hour window) or TOKENS_LIMIT (weekly
tokens).
unit: Option<String>Window unit (e.g. "5h", "week").
number: u64Configured cap for this window (tokens or prompt count).
percentage: f64Consumed percentage within the current window (0–100).
usage: Option<u64>Total quota amount reported by the server, when present.
current_value: Option<u64>Amount already consumed in the current window, when present.
remaining: Option<u64>Remaining amount reported by the server, when present.
next_reset_time: Option<String>When this window resets (server timestamp / ISO string).
usage_details: Vec<CodingPlanUsageDetail>Optional per-model breakdown for this quota window.
Implementations§
Source§impl CodingPlanQuotaLimit
impl CodingPlanQuotaLimit
Sourcepub fn kind(&self) -> CodingPlanQuotaKind
pub fn kind(&self) -> CodingPlanQuotaKind
Normalized quota kind.
Sourcepub fn quota(&self) -> u64
pub fn quota(&self) -> u64
Total quota amount when the server reports it, falling back to number.
Sourcepub fn remaining(&self) -> u64
pub fn remaining(&self) -> u64
Remaining amount in this window.
Uses the server-provided remaining field when present. Otherwise it
falls back to number * (1 - percentage/100).
Sourcepub fn remaining_ratio(&self) -> f64
pub fn remaining_ratio(&self) -> f64
Remaining fraction in [0.0, 1.0].
Sourcepub fn used(&self) -> u64
pub fn used(&self) -> u64
Alias for CodingPlanQuotaLimit::consumed.
Sourcepub fn next_reset_at(&self) -> Option<DateTime<Utc>>
pub fn next_reset_at(&self) -> Option<DateTime<Utc>>
Parsed reset time in UTC when next_reset_time is a Unix timestamp or
RFC3339 datetime.
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).
Sourcepub fn summary(&self) -> CodingPlanQuotaSummary
pub fn summary(&self) -> CodingPlanQuotaSummary
Build an easy-to-use normalized view for this quota window.
Sourcepub fn is_time_limit(&self) -> bool
pub fn is_time_limit(&self) -> bool
True when this is the per-5-hour time window.
Sourcepub fn is_tokens_limit(&self) -> bool
pub fn is_tokens_limit(&self) -> bool
True when this is the weekly tokens window.
Trait Implementations§
Source§impl Clone for CodingPlanQuotaLimit
impl Clone for CodingPlanQuotaLimit
Source§fn clone(&self) -> CodingPlanQuotaLimit
fn clone(&self) -> CodingPlanQuotaLimit
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 CodingPlanQuotaLimit
impl Debug for CodingPlanQuotaLimit
Source§impl<'de> Deserialize<'de> for CodingPlanQuotaLimit
impl<'de> Deserialize<'de> for CodingPlanQuotaLimit
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>,
Source§impl Display for CodingPlanQuotaLimit
impl Display for CodingPlanQuotaLimit
Auto Trait Implementations§
impl Freeze for CodingPlanQuotaLimit
impl RefUnwindSafe for CodingPlanQuotaLimit
impl Send for CodingPlanQuotaLimit
impl Sync for CodingPlanQuotaLimit
impl Unpin for CodingPlanQuotaLimit
impl UnsafeUnpin for CodingPlanQuotaLimit
impl UnwindSafe for CodingPlanQuotaLimit
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.