pub struct BudgetGate<'a> { /* private fields */ }Expand description
Pre-dispatch eligibility gate backed by the budget tracker.
All checks are O(dimensions) per task — linear in the number of budget dimensions allocated to the task, typically very small (1-3).
Implementations§
Source§impl<'a> BudgetGate<'a>
impl<'a> BudgetGate<'a>
Sourcepub fn new(tracker: &'a BudgetTracker) -> Self
pub fn new(tracker: &'a BudgetTracker) -> Self
Creates a gate that borrows the given tracker.
Sourcepub fn can_dispatch(&self, task_id: TaskId) -> bool
pub fn can_dispatch(&self, task_id: TaskId) -> bool
Returns true if no budget dimension is exhausted for this task.
Sourcepub fn check_threshold(
&self,
task_id: TaskId,
threshold_pct: u8,
) -> Vec<(BudgetDimension, u8)>
pub fn check_threshold( &self, task_id: TaskId, threshold_pct: u8, ) -> Vec<(BudgetDimension, u8)>
Returns the (dimension, pct) pairs that have crossed the given threshold.
Used by the dispatch loop to fire BudgetThresholdCrossed events.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for BudgetGate<'a>
impl<'a> RefUnwindSafe for BudgetGate<'a>
impl<'a> Send for BudgetGate<'a>
impl<'a> Sync for BudgetGate<'a>
impl<'a> Unpin for BudgetGate<'a>
impl<'a> UnsafeUnpin for BudgetGate<'a>
impl<'a> UnwindSafe for BudgetGate<'a>
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