pub struct PolicyState {
pub tools_invoked: usize,
pub consecutive_failures: usize,
pub total_runtime_ms: u64,
}Expand description
Per-session accounting state tracked alongside the Budget.
Fields§
§tools_invoked: usize§consecutive_failures: usize§total_runtime_ms: u64Implementations§
Source§impl PolicyState
impl PolicyState
Sourcepub fn record_run(&mut self, metrics: &ToolMetrics)
pub fn record_run(&mut self, metrics: &ToolMetrics)
Update state after a completed run.
Sourcepub fn budget_exceeded(&self, budget: &Budget) -> Option<String>
pub fn budget_exceeded(&self, budget: &Budget) -> Option<String>
Returns Some(reason) if any budget limit is already exhausted.
Trait Implementations§
Source§impl Debug for PolicyState
impl Debug for PolicyState
Source§impl Default for PolicyState
impl Default for PolicyState
Source§fn default() -> PolicyState
fn default() -> PolicyState
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PolicyState
impl RefUnwindSafe for PolicyState
impl Send for PolicyState
impl Sync for PolicyState
impl Unpin for PolicyState
impl UnsafeUnpin for PolicyState
impl UnwindSafe for PolicyState
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