pub struct RateWindow {
pub used_percent: f64,
pub raw_used_percent: Option<f64>,
pub resets_at: Option<String>,
pub window_minutes: Option<i64>,
pub used_count: Option<f64>,
pub total_count: Option<f64>,
}Expand description
One rate-limit window: how much of a quota pool is spent and when it resets.
Fields§
§used_percent: f640..100 percent of the window’s quota consumed. This is the EFFECTIVE
number consumers pace on: when banked-reset relaxation applies it is
zeroed, and the provider-reported percent moves to raw_used_percent.
raw_used_percent: Option<f64>The provider-reported percent when used_percent has been relaxed to
an effective value (banked resets guarantee the window resets before
the wall).
Pace on used_percent, not on this. The effective number is the real
headroom: a reset that is going to happen has already been accounted for.
Treating this as the truer figure routes work away from an account whose
credit is about to be spent — and the credit expires whether or not it is
used, so the cautious-looking reading is the lossy one. Display it beside
the effective number in a human-facing view, where a zero next to real
consumption would otherwise look like a fault.
Emitted only where the two diverge, so its absence means they agree
and falling back to used_percent is exact rather than approximate.
Rendering a placeholder for absence would be wrong on every unrelaxed
window, which is nearly all of them.
resets_at: Option<String>ISO 8601 / RFC 3339 timestamp when the window resets. Omitted when the provider reports no reset (e.g. an idle session window with nothing pending) — never fabricated.
window_minutes: Option<i64>Window length in minutes. Omitted when the provider does not report one; the consumer then paces on utilization alone rather than a burn rate.
used_count: Option<f64>Absolute consumed count in the window (e.g. tokens, requests). Present only when the provider reports or derives it; human-facing UIs can show “10,336 / 40,000” alongside the percentage for richer context.
total_count: Option<f64>Absolute total cap for the window. Present alongside used_count when
the provider knows the ceiling; omitted otherwise.
Trait Implementations§
Source§impl Clone for RateWindow
impl Clone for RateWindow
Source§fn clone(&self) -> RateWindow
fn clone(&self) -> RateWindow
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more