pub struct Reservation { /* private fields */ }Expand description
A cancellation-safe reservation for one resource.
Implementations§
Source§impl Reservation
impl Reservation
Sourcepub fn commit(self, actual: u64) -> Result<(), BudgetError>
pub fn commit(self, actual: u64) -> Result<(), BudgetError>
Reconciles actual usage and releases unused capacity.
If actual exceeds the reservation, the complete reservation is
converted to consumed capacity before the error is returned. The caller
is responsible for externally constraining operations when a hard upper
bound is required.
§Errors
Returns BudgetError::ReservationExceeded after retaining the full
reservation as consumed when actual exceeds the reserved amount.
Trait Implementations§
Source§impl Debug for Reservation
impl Debug for Reservation
Source§impl Drop for Reservation
impl Drop for Reservation
Auto Trait Implementations§
impl Freeze for Reservation
impl RefUnwindSafe for Reservation
impl Send for Reservation
impl Sync for Reservation
impl Unpin for Reservation
impl UnsafeUnpin for Reservation
impl UnwindSafe for Reservation
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