pub struct BudgetReservation { /* private fields */ }Expand description
A scoped share of a run tree’s hard budget.
Cloned trackers returned by Self::tracker consume only this
reservation. Unused resources are released when the reservation and all of
its scoped tracker clones are dropped.
Implementations§
Source§impl BudgetReservation
impl BudgetReservation
Sourcepub fn tracker(&self) -> BudgetTracker
pub fn tracker(&self) -> BudgetTracker
Returns a tracker constrained to this reservation.
Sourcepub fn forfeit_remaining(&self) -> Result<Usage, BudgetExceeded>
pub fn forfeit_remaining(&self) -> Result<Usage, BudgetExceeded>
Conservatively commits every unconsumed resource in this reservation.
This is useful when work may continue remotely after local cancellation and its terminal usage can no longer be observed.
§Errors
Returns BudgetExceeded if an accounting counter overflows.
Trait Implementations§
Source§impl Clone for BudgetReservation
impl Clone for BudgetReservation
Source§fn clone(&self) -> BudgetReservation
fn clone(&self) -> BudgetReservation
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 moreAuto Trait Implementations§
impl Freeze for BudgetReservation
impl RefUnwindSafe for BudgetReservation
impl Send for BudgetReservation
impl Sync for BudgetReservation
impl Unpin for BudgetReservation
impl UnsafeUnpin for BudgetReservation
impl UnwindSafe for BudgetReservation
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