pub struct Reservation { /* private fields */ }Expand description
RAII memory reservation: releases its bytes back to the governor on drop.
Two words plus one Arc refcount — no allocation. Send/Sync, so a
reservation can move across threads and live inside async tasks. Leaking a
reservation (mem::forget) leaks its accounting but is memory-safe.
Implementations§
Source§impl Reservation
impl Reservation
Sourcepub fn class(&self) -> MemoryClass
pub fn class(&self) -> MemoryClass
The class this reservation charged.
Sourcepub fn resize(&mut self, new_bytes: u64) -> Result<(), MemoryError>
pub fn resize(&mut self, new_bytes: u64) -> Result<(), MemoryError>
Resizes the reservation. Shrinking always succeeds; growth goes
through the same admission rules as
try_reserve and leaves the reservation
unchanged on failure.
Trait Implementations§
Source§impl Debug for Reservation
impl Debug for Reservation
Source§impl Drop for Reservation
impl Drop for Reservation
Auto Trait Implementations§
impl !RefUnwindSafe for Reservation
impl !UnwindSafe for Reservation
impl Freeze for Reservation
impl Send for Reservation
impl Sync for Reservation
impl Unpin for Reservation
impl UnsafeUnpin 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more