pub struct BudgetTracker { /* private fields */ }Expand description
What one phase has spent so far. Shared by every task the phase runs.
Implementations§
Source§impl BudgetTracker
impl BudgetTracker
Sourcepub fn reserve(&self, depth: u8) -> Result<(), BudgetBound>
pub fn reserve(&self, depth: u8) -> Result<(), BudgetBound>
Reserves one call at depth.
§Errors
The BudgetBound that forbids it; the bound is also remembered for the report.
Sourcepub async fn permit(&self) -> Option<SemaphorePermit<'_>>
pub async fn permit(&self) -> Option<SemaphorePermit<'_>>
Waits for a slot among the calls in flight.
Sourcepub fn record_tokens(&self, tokens: u64)
pub fn record_tokens(&self, tokens: u64)
Counts the prompt tokens a provider reported.
Sourcepub fn remaining_wall_clock(&self) -> Option<Duration>
pub fn remaining_wall_clock(&self) -> Option<Duration>
Time left on the wall clock, when it is bounded.
Sourcepub fn call_timeout(&self, requested: Option<Duration>) -> Duration
pub fn call_timeout(&self, requested: Option<Duration>) -> Duration
The deadline of the next call: the per-call timeout, cut to the time left.
Sourcepub fn exhausted(&self) -> Option<BudgetBound>
pub fn exhausted(&self) -> Option<BudgetBound>
The first bound reached, if any.
Sourcepub fn report(&self) -> BudgetReport
pub fn report(&self) -> BudgetReport
What was spent, for the replay record.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BudgetTracker
impl RefUnwindSafe for BudgetTracker
impl Send for BudgetTracker
impl Sync for BudgetTracker
impl Unpin for BudgetTracker
impl UnsafeUnpin for BudgetTracker
impl UnwindSafe for BudgetTracker
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