pub struct MessageCost {
pub input: f64,
pub output: f64,
pub cache_read: f64,
pub cache_write: f64,
pub total: f64,
}Expand description
Cost of a message with full breakdown (pi-style).
Pi stores usage.cost as { input, output, cacheRead, cacheWrite, total }.
This matches that structure. Old sessions serialize cost as a plain number;
we handle both formats via custom serde.
Fields§
§input: f64§output: f64§cache_read: f64§cache_write: f64§total: f64Implementations§
Trait Implementations§
Source§impl Clone for MessageCost
impl Clone for MessageCost
Source§fn clone(&self) -> MessageCost
fn clone(&self) -> MessageCost
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 moreimpl Copy for MessageCost
Source§impl Debug for MessageCost
impl Debug for MessageCost
Source§impl Default for MessageCost
impl Default for MessageCost
Source§fn default() -> MessageCost
fn default() -> MessageCost
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for MessageCost
Custom deserializer: accepts both the object form (new format) and a plain
number (old format: "cost": 0.0123).
impl<'de> Deserialize<'de> for MessageCost
Custom deserializer: accepts both the object form (new format) and a plain
number (old format: "cost": 0.0123).
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MessageCost
impl RefUnwindSafe for MessageCost
impl Send for MessageCost
impl Sync for MessageCost
impl Unpin for MessageCost
impl UnsafeUnpin for MessageCost
impl UnwindSafe for MessageCost
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