pub struct UsageMetrics {
pub input_tokens: Option<i64>,
pub output_tokens: Option<i64>,
pub total_tokens: Option<i64>,
pub cached_tokens: Option<i64>,
pub reasoning_tokens: Option<i64>,
}Expand description
Token usage observed from upstream chunks.
Fields§
§input_tokens: Option<i64>§output_tokens: Option<i64>§total_tokens: Option<i64>§cached_tokens: Option<i64>§reasoning_tokens: Option<i64>Implementations§
Source§impl UsageMetrics
impl UsageMetrics
Sourcepub fn update_from_chunk(&mut self, chunk: &ChatStreamChunk)
pub fn update_from_chunk(&mut self, chunk: &ChatStreamChunk)
Absorb token counts from a streaming chunk’s usage block, if present.
Trait Implementations§
Source§impl Clone for UsageMetrics
impl Clone for UsageMetrics
Source§fn clone(&self) -> UsageMetrics
fn clone(&self) -> UsageMetrics
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 UsageMetrics
impl Debug for UsageMetrics
Source§impl Default for UsageMetrics
impl Default for UsageMetrics
Source§fn default() -> UsageMetrics
fn default() -> UsageMetrics
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for UsageMetrics
impl RefUnwindSafe for UsageMetrics
impl Send for UsageMetrics
impl Sync for UsageMetrics
impl Unpin for UsageMetrics
impl UnsafeUnpin for UsageMetrics
impl UnwindSafe for UsageMetrics
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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