pub struct ExtraUsage {
pub limit: Option<Cents>,
pub spent: Cents,
pub currency: Option<String>,
pub decimal_places: Option<u32>,
}Expand description
“Extra usage” pay-as-you-go block (claudebar’s extra_usage).
Fields§
§limit: Option<Cents>None when the payload carries no usable monthly_limit — an
explicit null (observed for plans without a spending cap, e.g. Claude
Pro, #30) or an absent field. Either way the spend is real and stays
visible; only the limit is unreported, and the renderers say exactly
that rather than inferring a plan tier from it.
spent: Cents§currency: Option<String>ISO code from the block ("BRL", "USD", …). None on older payloads
that predate the field — formatted as $ for back-compat, which was
the only behaviour before the field existed.
decimal_places: Option<u32>Minor-unit digits from the block’s decimal_places (BRL/USD = 2,
JPY/KRW = 0). None means the wire did not report the scale. We keep
that absence instead of guessing from an incomplete currency table.
Implementations§
Source§impl ExtraUsage
impl ExtraUsage
Sourcepub fn percent(&self) -> i32
pub fn percent(&self) -> i32
Integer percentage of the monthly limit consumed (0..=100, saturating at 0 when limit is non-positive — matches claudebar:540-542).
With no cap there is no denominator, so no meaningful percentage exists; 0 keeps the bar and severity calm rather than inventing one.
pub fn fmt_spent(&self) -> String
pub fn fmt_limit(&self) -> Option<String>
Trait Implementations§
Source§impl Clone for ExtraUsage
impl Clone for ExtraUsage
Source§fn clone(&self) -> ExtraUsage
fn clone(&self) -> ExtraUsage
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 ExtraUsage
impl Debug for ExtraUsage
impl Eq for ExtraUsage
Source§impl PartialEq for ExtraUsage
impl PartialEq for ExtraUsage
impl StructuralPartialEq for ExtraUsage
Auto Trait Implementations§
impl Freeze for ExtraUsage
impl RefUnwindSafe for ExtraUsage
impl Send for ExtraUsage
impl Sync for ExtraUsage
impl Unpin for ExtraUsage
impl UnsafeUnpin for ExtraUsage
impl UnwindSafe for ExtraUsage
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,
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
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>
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