pub struct TrackingAllocator<A: GlobalAlloc> { /* private fields */ }Expand description
Custom allocator that tracks memory usage
Implementations§
Source§impl<A: GlobalAlloc> TrackingAllocator<A>
impl<A: GlobalAlloc> TrackingAllocator<A>
pub fn new(inner: A) -> Self
pub fn stats(&self) -> AllocationStats
pub fn reset_stats(&self)
Trait Implementations§
Source§impl<A: GlobalAlloc> GlobalAlloc for TrackingAllocator<A>
impl<A: GlobalAlloc> GlobalAlloc for TrackingAllocator<A>
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl<A> Freeze for TrackingAllocator<A>where
A: Freeze,
impl<A> RefUnwindSafe for TrackingAllocator<A>where
A: RefUnwindSafe,
impl<A> Send for TrackingAllocator<A>where
A: Send,
impl<A> Sync for TrackingAllocator<A>where
A: Sync,
impl<A> Unpin for TrackingAllocator<A>where
A: Unpin,
impl<A> UnwindSafe for TrackingAllocator<A>where
A: UnwindSafe,
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