pub struct CumulativeUsage { /* private fields */ }Expand description
Accumulated usage across multiple turns.
Implementations§
Source§impl CumulativeUsage
impl CumulativeUsage
Sourcepub fn from_totals(
input_tokens: u64,
output_tokens: u64,
cache_read_tokens: u64,
cache_write_tokens: u64,
turns: u32,
) -> Self
pub fn from_totals( input_tokens: u64, output_tokens: u64, cache_read_tokens: u64, cache_write_tokens: u64, turns: u32, ) -> Self
Construct from pre-computed totals (e.g. when replaying a session).
pub fn total_input_tokens(&self) -> u64
pub fn total_output_tokens(&self) -> u64
pub fn total_cache_read_tokens(&self) -> u64
pub fn total_cache_write_tokens(&self) -> u64
pub fn turn_count(&self) -> u32
pub fn accumulate(&mut self, turn: &Usage)
pub fn as_usage(&self) -> Usage
Trait Implementations§
Source§impl Clone for CumulativeUsage
impl Clone for CumulativeUsage
Source§fn clone(&self) -> CumulativeUsage
fn clone(&self) -> CumulativeUsage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CumulativeUsage
impl Debug for CumulativeUsage
Source§impl Default for CumulativeUsage
impl Default for CumulativeUsage
Source§fn default() -> CumulativeUsage
fn default() -> CumulativeUsage
Returns the “default value” for a type. Read more
Source§impl PartialEq for CumulativeUsage
impl PartialEq for CumulativeUsage
Source§fn eq(&self, other: &CumulativeUsage) -> bool
fn eq(&self, other: &CumulativeUsage) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for CumulativeUsage
Auto Trait Implementations§
impl Freeze for CumulativeUsage
impl RefUnwindSafe for CumulativeUsage
impl Send for CumulativeUsage
impl Sync for CumulativeUsage
impl Unpin for CumulativeUsage
impl UnsafeUnpin for CumulativeUsage
impl UnwindSafe for CumulativeUsage
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