pub struct UsagePeriod {
pub utilization: f64,
pub resets_at: DateTime<Utc>,
}Expand description
Usage data for a specific time period.
Fields§
§utilization: f64Percentage of quota used (0.0 - 100.0+).
Values over 100.0 indicate quota exceeded.
resets_at: DateTime<Utc>When this period’s quota resets.
Implementations§
Source§impl UsagePeriod
impl UsagePeriod
Sourcepub fn time_until_reset(&self) -> TimeDelta
pub fn time_until_reset(&self) -> TimeDelta
Calculate time remaining until this period resets.
Returns a negative duration if the reset time has passed.
Sourcepub fn time_elapsed_percent(&self, period_hours: u32) -> f64
pub fn time_elapsed_percent(&self, period_hours: u32) -> f64
Sourcepub fn is_on_pace(&self, period_hours: u32) -> bool
pub fn is_on_pace(&self, period_hours: u32) -> bool
Check if usage is on pace with time elapsed.
Returns true if utilization percentage is less than or equal to
the percentage of time elapsed. This indicates sustainable usage
that won’t exceed quota before reset.
§Arguments
period_hours- Total duration of the period in hours
Trait Implementations§
Source§impl Clone for UsagePeriod
impl Clone for UsagePeriod
Source§fn clone(&self) -> UsagePeriod
fn clone(&self) -> UsagePeriod
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 UsagePeriod
impl Debug for UsagePeriod
Source§impl<'de> Deserialize<'de> for UsagePeriod
impl<'de> Deserialize<'de> for UsagePeriod
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for UsagePeriod
impl PartialEq for UsagePeriod
Source§impl Serialize for UsagePeriod
impl Serialize for UsagePeriod
impl StructuralPartialEq for UsagePeriod
Auto Trait Implementations§
impl Freeze for UsagePeriod
impl RefUnwindSafe for UsagePeriod
impl Send for UsagePeriod
impl Sync for UsagePeriod
impl Unpin for UsagePeriod
impl UnwindSafe for UsagePeriod
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