pub struct MetricAlloc<A: GlobalAlloc> { /* private fields */ }
Expand description
A global allocator type that tracks allocation metrics.
This type makes use of shared memory in order to aggregate metrics while still supporting arbitrary global allocator composition. Because of this, there should only ever be at most one instance of it (hence being a global allocator).
Implementations§
Source§impl<A: GlobalAlloc> MetricAlloc<A>
impl<A: GlobalAlloc> MetricAlloc<A>
Trait Implementations§
Source§impl<A: GlobalAlloc> GlobalAlloc for MetricAlloc<A>
impl<A: GlobalAlloc> GlobalAlloc for MetricAlloc<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 moreSource§unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
Behaves like
alloc
, but also ensures that the contents
are set to zero before being returned. Read moreAuto Trait Implementations§
impl<A> Freeze for MetricAlloc<A>where
A: Freeze,
impl<A> RefUnwindSafe for MetricAlloc<A>where
A: RefUnwindSafe,
impl<A> Send for MetricAlloc<A>where
A: Send,
impl<A> Sync for MetricAlloc<A>where
A: Sync,
impl<A> Unpin for MetricAlloc<A>where
A: Unpin,
impl<A> UnwindSafe for MetricAlloc<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