pub struct BillingBlockUsage {
pub input_tokens: u64,
pub output_tokens: u64,
pub cache_creation_tokens: u64,
pub cache_read_tokens: u64,
pub total_cost: f64,
pub session_count: usize,
}Expand description
Usage statistics for a billing block
Fields§
§input_tokens: u64Input tokens
output_tokens: u64Output tokens
cache_creation_tokens: u64Cache creation tokens
cache_read_tokens: u64Cache read tokens
total_cost: f64Total cost in USD
session_count: usizeNumber of sessions in this block
Implementations§
Source§impl BillingBlockUsage
impl BillingBlockUsage
Sourcepub fn total_tokens(&self) -> u64
pub fn total_tokens(&self) -> u64
Total tokens (input + output + cache creation + cache read)
IMPORTANT: This must match ccusage behavior which includes ALL token types. Previously missed cache_read_tokens, causing discrepancies with ccusage totals.
Sourcepub fn add(&mut self, other: &BillingBlockUsage)
pub fn add(&mut self, other: &BillingBlockUsage)
Add usage from another block
Trait Implementations§
Source§impl Clone for BillingBlockUsage
impl Clone for BillingBlockUsage
Source§fn clone(&self) -> BillingBlockUsage
fn clone(&self) -> BillingBlockUsage
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 BillingBlockUsage
impl Debug for BillingBlockUsage
Source§impl Default for BillingBlockUsage
impl Default for BillingBlockUsage
Source§fn default() -> BillingBlockUsage
fn default() -> BillingBlockUsage
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for BillingBlockUsage
impl<'de> Deserialize<'de> for BillingBlockUsage
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
Auto Trait Implementations§
impl Freeze for BillingBlockUsage
impl RefUnwindSafe for BillingBlockUsage
impl Send for BillingBlockUsage
impl Sync for BillingBlockUsage
impl Unpin for BillingBlockUsage
impl UnwindSafe for BillingBlockUsage
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