pub struct AllocTracker { /* private fields */ }
Expand description
Allocation tracker with total memory limit.
Implementations§
Source§impl AllocTracker
impl AllocTracker
Sourcepub fn with_limit(bytes_left: usize) -> AllocTracker
pub fn with_limit(bytes_left: usize) -> AllocTracker
Creates a memory allocation tracker with allowed allocation limit.
Sourcepub fn alloc<T>(&self, count: usize) -> Result<AllocHandle, Error>
pub fn alloc<T>(&self, count: usize) -> Result<AllocHandle, Error>
Records an allocation of count
number of T
, and returns handle of the record.
Returns an error if the allocation exceeds the current limit.
Sourcepub fn expand_limit(&self, by_bytes: usize)
pub fn expand_limit(&self, by_bytes: usize)
Expands the current limit by by_bytes
bytes.
Trait Implementations§
Source§impl Clone for AllocTracker
impl Clone for AllocTracker
Source§fn clone(&self) -> AllocTracker
fn clone(&self) -> AllocTracker
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for AllocTracker
impl RefUnwindSafe for AllocTracker
impl Send for AllocTracker
impl Sync for AllocTracker
impl Unpin for AllocTracker
impl UnwindSafe for AllocTracker
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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