pub struct BudgetState {
pub input_tokens: u64,
pub output_tokens: u64,
/* private fields */
}Expand description
Running tally of spend within a round, checked against a TokenBudget.
Fields§
§input_tokens: u64§output_tokens: u64Implementations§
Source§impl BudgetState
impl BudgetState
pub fn new(budget: TokenBudget) -> Self
pub fn total_tokens(&self) -> u64
Sourcepub fn exceeded(&self) -> Option<BudgetLimit>
pub fn exceeded(&self) -> Option<BudgetLimit>
Returns the first limit that has been crossed, if any. The engine checks this after each sub-agent so it can stop before spawning the next one.
Trait Implementations§
Source§impl Clone for BudgetState
impl Clone for BudgetState
Source§fn clone(&self) -> BudgetState
fn clone(&self) -> BudgetState
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 BudgetState
Auto Trait Implementations§
impl Freeze for BudgetState
impl RefUnwindSafe for BudgetState
impl Send for BudgetState
impl Sync for BudgetState
impl Unpin for BudgetState
impl UnsafeUnpin for BudgetState
impl UnwindSafe for BudgetState
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