mirror of
https://wget.la/https://github.com/leookun/cursor-byok
synced 2026-08-18 20:19:18 +08:00
23 lines
659 B
Rust
23 lines
659 B
Rust
use std::ops::AddAssign;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
|
|
pub struct Usage {
|
|
pub input_tokens: u64,
|
|
pub output_tokens: u64,
|
|
pub cache_read_tokens: u64,
|
|
pub cache_write_tokens: u64,
|
|
pub reasoning_tokens: u64,
|
|
}
|
|
|
|
impl AddAssign for Usage {
|
|
fn add_assign(&mut self, rhs: Self) {
|
|
self.input_tokens += rhs.input_tokens;
|
|
self.output_tokens += rhs.output_tokens;
|
|
self.cache_read_tokens += rhs.cache_read_tokens;
|
|
self.cache_write_tokens += rhs.cache_write_tokens;
|
|
self.reasoning_tokens += rhs.reasoning_tokens;
|
|
}
|
|
}
|