pub struct MemoryBudget { /* private fields */ }Expand description
A weighted byte budget shared by concurrent work.
Implementations§
Source§impl MemoryBudget
impl MemoryBudget
Sourcepub fn from_probe(
probe: &dyn MemoryProbe,
fraction: f64,
floor_bytes: u64,
) -> Self
pub fn from_probe( probe: &dyn MemoryProbe, fraction: f64, floor_bytes: u64, ) -> Self
Uses fraction of the probed bytes, with floor_bytes as a minimum.
Sourcepub fn acquire(
&self,
bytes: u64,
cancel: &CancelToken,
) -> Result<MemoryPermit<'_>, MemoryError>
pub fn acquire( &self, bytes: u64, cancel: &CancelToken, ) -> Result<MemoryPermit<'_>, MemoryError>
Waits for and reserves bytes until the returned permit is dropped.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for MemoryBudget
impl RefUnwindSafe for MemoryBudget
impl Send for MemoryBudget
impl Sync for MemoryBudget
impl Unpin for MemoryBudget
impl UnsafeUnpin for MemoryBudget
impl UnwindSafe for MemoryBudget
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