pub struct WindowLimit {
pub id: String,
pub duration_ms: Option<u64>,
pub used_percent: Option<f64>,
pub limit_reached: Option<bool>,
pub resets_at_ms: Option<u64>,
pub models: Option<Vec<String>>,
}Expand description
One provider-reported rate-limit window, normalized by the usage adapter.
models == None means the window applies to every model on the account;
Some(list) scopes it to exactly those model ids.
Fields§
§id: StringProvider-side identifier (e.g. primary, seven_day_sonnet). Display only.
duration_ms: Option<u64>Window length as reported by the provider, if known.
used_percent: Option<f64>Utilization in percent (0..=100), if reported.
limit_reached: Option<bool>Provider’s explicit “limit reached” flag, if reported. Adapters must
set Some(false) ONLY when the provider asserts it (it counts as
headroom evidence when no percentage is available); an absent flag
must be None.
resets_at_ms: Option<u64>Provider-reported reset instant (epoch ms), if reported. Authoritative.
models: Option<Vec<String>>Model scope. None = account-wide.
Implementations§
Source§impl WindowLimit
impl WindowLimit
Sourcepub fn applies_to(&self, model: Option<&str>) -> bool
pub fn applies_to(&self, model: Option<&str>) -> bool
Whether this window constrains model (None = any model).
Sourcepub fn verdict(&self, exhausted_at_percent: f64) -> WindowVerdict
pub fn verdict(&self, exhausted_at_percent: f64) -> WindowVerdict
Capacity verdict. Exhaustion threshold is inclusive. A provider
limit_reached: true flag always wins; malformed percentages are
unknown (never capacity). An invalid threshold (non-finite or outside
0..=100) fails closed: the verdict is Unknown.
Trait Implementations§
Source§impl Clone for WindowLimit
impl Clone for WindowLimit
Source§fn clone(&self) -> WindowLimit
fn clone(&self) -> WindowLimit
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 WindowLimit
impl Debug for WindowLimit
Source§impl<'de> Deserialize<'de> for WindowLimit
impl<'de> Deserialize<'de> for WindowLimit
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<WindowLimit, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<WindowLimit, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for WindowLimit
impl PartialEq for WindowLimit
Source§impl Serialize for WindowLimit
impl Serialize for WindowLimit
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for WindowLimit
Auto Trait Implementations§
impl Freeze for WindowLimit
impl RefUnwindSafe for WindowLimit
impl Send for WindowLimit
impl Sync for WindowLimit
impl Unpin for WindowLimit
impl UnsafeUnpin for WindowLimit
impl UnwindSafe for WindowLimit
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more