#[non_exhaustive]pub struct Tokens {
pub prompt: u64,
pub completion: u64,
pub cache_read: u64,
pub cache_creation: u64,
}Expand description
Token counts for one level, mirroring tcode_report.json’s usage block.
Why: #5441 asks for tokens AND cache use separately — a cost change driven
by a collapsed cache read is a different finding from one driven by more
completion tokens.
What: the same four counters run_task::report renders.
Test: bakeoff::tests::token_regression_beyond_tolerance_needs_a_disposition.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.prompt: u64Prompt tokens billed.
completion: u64Completion tokens billed.
cache_read: u64Tokens served from the provider’s prompt cache.
cache_creation: u64Tokens written into the provider’s prompt cache.
Implementations§
Source§impl Tokens
impl Tokens
Sourcepub fn total(self) -> u64
pub fn total(self) -> u64
Total billed tokens across all four counters.
Why: the baseline comparison needs one scalar per metric; four separate
tolerance verdicts on correlated counters produce noise, not signal.
What: saturating sum of the four fields.
Test: bakeoff::tests::token_regression_beyond_tolerance_needs_a_disposition.
Trait Implementations§
impl Copy for Tokens
Source§impl<'de> Deserialize<'de> for Tokens
impl<'de> Deserialize<'de> for Tokens
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>,
impl Eq for Tokens
impl StructuralPartialEq for Tokens
Auto Trait Implementations§
impl Freeze for Tokens
impl RefUnwindSafe for Tokens
impl Send for Tokens
impl Sync for Tokens
impl Unpin for Tokens
impl UnsafeUnpin for Tokens
impl UnwindSafe for Tokens
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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