pub struct UsagePermit { /* private fields */ }Expand description
One reserved accounting slot. Send the committed request’s event with
record; dropping the permit (deny, cancel,
zero-charge path) releases the slot.
Implementations§
Source§impl UsagePermit
impl UsagePermit
Sourcepub fn record(self, event: UsageEvent)
pub fn record(self, event: UsageEvent)
Send the committed request’s event into the reserved slot. Never blocks and cannot fail: the slot was reserved before admission. The event counts as unaccounted until the writer gives it a billing outcome.
Trait Implementations§
Source§impl Drop for UsagePermit
impl Drop for UsagePermit
Source§impl UsageSlot for UsagePermit
impl UsageSlot for UsagePermit
Source§fn record(self, event: UsageEvent)
fn record(self, event: UsageEvent)
Record the charge into the capacity this slot reserved. Called from the
committed guard’s drop, so it must not block, allocate fallibly or
fail.
Auto Trait Implementations§
impl Freeze for UsagePermit
impl RefUnwindSafe for UsagePermit
impl Send for UsagePermit
impl Sync for UsagePermit
impl Unpin for UsagePermit
impl UnsafeUnpin for UsagePermit
impl UnwindSafe for UsagePermit
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