pub struct Snapshot {
pub plan: Option<String>,
pub five_hour: Option<SpendWindow>,
pub weekly: Option<SpendWindow>,
pub credits: Option<Credits>,
pub credit_pool: Option<f64>,
pub period_end: Option<DateTime<Utc>>,
}Expand description
Everything the widget shows for Command Code.
Fields§
§plan: Option<String>Plan label, e.g. “GOAT”. None until the subscription is read.
five_hour: Option<SpendWindow>§weekly: Option<SpendWindow>§credits: Option<Credits>§credit_pool: Option<f64>Monthly credit allowance for the plan, when the plan is recognised.
period_end: Option<DateTime<Utc>>End of the current billing period — when the monthly credit ledger refills. The windows reset on their own clocks; only the subscription carries this instant.
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn worst_pct(&self) -> i32
pub fn worst_pct(&self) -> i32
The window closest to its cap, which is what the bar text leads with.
Sourcepub fn credits_spent(&self) -> Option<f64>
pub fn credits_spent(&self) -> Option<f64>
Fraction of the monthly allowance already spent, when both are known.
Sourcepub fn monthly_window(&self) -> Option<SpendWindow>
pub fn monthly_window(&self) -> Option<SpendWindow>
The monthly credit allowance as a spend window: dollars drawn from the plan’s pool, refilling at the billing period end. Needs the ledger and a recognised plan; the subscription supplies the refill instant.
Trait Implementations§
impl Eq for Snapshot
impl StructuralPartialEq for Snapshot
Auto Trait Implementations§
impl Freeze for Snapshot
impl RefUnwindSafe for Snapshot
impl Send for Snapshot
impl Sync for Snapshot
impl Unpin for Snapshot
impl UnsafeUnpin for Snapshot
impl UnwindSafe for Snapshot
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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> ⓘ
Converts
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> ⓘ
Converts
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