pub struct MemorySlicerGuard<'a> { /* private fields */ }Implementations§
Source§impl MemorySlicerGuard<'_>
impl MemorySlicerGuard<'_>
pub fn range(&self) -> MemorySlicerRange
pub fn total(&self) -> ByteSize
pub fn available(&self) -> ByteSize
pub fn snapshot(&self) -> MemorySlicer
pub fn alloc_fixed(&mut self, bytes: ByteSize) -> bool
pub fn alloc_ratio(&mut self, nom: usize, denom: usize) -> Option<ByteSize>
pub fn alloc_in_range<R: RangeBounds<ByteSize>>( &mut self, bytes: R, ) -> Option<ByteSize>
Sourcepub fn alloc_constraints<C: MemoryConstraints>(
&mut self,
constraints: C,
) -> Result<C::Output, ByteSize>
pub fn alloc_constraints<C: MemoryConstraints>( &mut self, constraints: C, ) -> Result<C::Output, ByteSize>
Tries to allocate an amount of memory which satisfies provided constraints.
On success returns allocated amounts in the same order as constraints. Otherwise returns the minimum required memory size (total).
Sourcepub fn overflowing_alloc_constraints<C: MemoryConstraints>(
&mut self,
constraints: C,
) -> AllocatedMemoryConstraints<C::Output>
pub fn overflowing_alloc_constraints<C: MemoryConstraints>( &mut self, constraints: C, ) -> AllocatedMemoryConstraints<C::Output>
Tries to allocate an amount of memory which satisfies provided constraints.
In case of overflow still allocates, but returns the required remainder
in AllocatedMemoryConstraints::overflow.
pub fn subdivide(&mut self, bytes: ByteSize) -> Option<MemorySlicer>
pub fn subdivide_ratio( &mut self, nom: usize, denom: usize, ) -> Option<MemorySlicer>
pub fn subdivide_in_range<R: RangeBounds<ByteSize>>( &mut self, bytes: R, ) -> Option<MemorySlicer>
Auto Trait Implementations§
impl<'a> Freeze for MemorySlicerGuard<'a>
impl<'a> RefUnwindSafe for MemorySlicerGuard<'a>
impl<'a> !Send for MemorySlicerGuard<'a>
impl<'a> Sync for MemorySlicerGuard<'a>
impl<'a> Unpin for MemorySlicerGuard<'a>
impl<'a> UnwindSafe for MemorySlicerGuard<'a>
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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