made_core/value_objects/budget/
budget_quantities.rs1use super::{BudgetTokenCount, CostMicros, ExecutionDuration, ToolCallCount};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
5pub struct BudgetQuantities {
6 duration: ExecutionDuration,
7 tokens: BudgetTokenCount,
8 cost: CostMicros,
9 tool_calls: ToolCallCount,
10}
11impl BudgetQuantities {
12 #[must_use]
13 pub const fn new(
14 duration: ExecutionDuration,
15 tokens: BudgetTokenCount,
16 cost: CostMicros,
17 tool_calls: ToolCallCount,
18 ) -> Self {
19 Self {
20 duration,
21 tokens,
22 cost,
23 tool_calls,
24 }
25 }
26 #[must_use]
27 pub const fn duration(self) -> ExecutionDuration {
28 self.duration
29 }
30 #[must_use]
31 pub const fn tokens(self) -> BudgetTokenCount {
32 self.tokens
33 }
34 #[must_use]
35 pub const fn cost(self) -> CostMicros {
36 self.cost
37 }
38 #[must_use]
39 pub const fn tool_calls(self) -> ToolCallCount {
40 self.tool_calls
41 }
42 #[must_use]
43 pub const fn is_zero(self) -> bool {
44 self.duration.as_micros() == 0
45 && self.tokens.value() == 0
46 && self.cost.value() == 0
47 && self.tool_calls.value() == 0
48 }
49}