pub type Hold<'a> = ReservationImpl<&'a Reservation, Reservation>;
Aliased Type§
struct Hold<'a> { /* private fields */ }
Implementations
Source§impl<T: Borrow<U> + Clone + Send + Sync, U: ReservationOwner + ?Sized> ReservationImpl<T, U>
impl<T: Borrow<U> + Clone + Send + Sync, U: ReservationOwner + ?Sized> ReservationImpl<T, U>
pub fn new(owner: T, owner_object_id: Option<u64>, amount: u64) -> Self
pub fn owner_object_id(&self) -> Option<u64>
Sourcepub fn amount(&self) -> u64
pub fn amount(&self) -> u64
Returns the total amount of the reservation, not accounting for anything that might be held.
Sourcepub fn forget(&self) -> u64
pub fn forget(&self) -> u64
Returns the entire amount of the reservation. The caller is responsible for maintaining consistency, i.e. updating counters, etc, and there can be no sub-reservations (an assert will fire otherwise).
Sourcepub fn forget_some(&self, amount: u64)
pub fn forget_some(&self, amount: u64)
Takes some of the reservation. The caller is responsible for maintaining consistency, i.e. updating counters, etc. This will assert that the amount being forgotten does not exceed the available reservation amount; the caller should ensure that this is the case.
Sourcepub fn reserve(&self, amount: u64) -> Option<ReservationImpl<&Self, Self>>
pub fn reserve(&self, amount: u64) -> Option<ReservationImpl<&Self, Self>>
Reserves exactly amount if possible.
Sourcepub fn commit(&self, amount: u64)
pub fn commit(&self, amount: u64)
Commits a previously reserved amount from this reservation. The caller is responsible for ensuring the amount was reserved.
Sourcepub fn move_to<V: Borrow<W> + Clone + Send + Sync, W: ReservationOwner + ?Sized>(
&self,
other: &ReservationImpl<V, W>,
amount: u64,
)
pub fn move_to<V: Borrow<W> + Clone + Send + Sync, W: ReservationOwner + ?Sized>( &self, other: &ReservationImpl<V, W>, amount: u64, )
Moves amount
from this reservation to another reservation.