pub struct Alloc;Available on crate feature
dhat-compat only.Expand description
Drop-in replacement for dhat::Alloc.
Unit struct usable in the literal static A: Alloc = Alloc;
pattern that dhat-rs documents. Internally forwards every
allocation to a process-wide static crate::ModAlloc so
HeapStats::get() and Profiler find the live counters.
§Example
use mod_alloc::dhat_compat::Alloc;
#[global_allocator]
static ALLOC: Alloc = Alloc;Implementations§
Trait Implementations§
Source§impl GlobalAlloc for Alloc
impl GlobalAlloc for Alloc
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 Freeze for Alloc
impl RefUnwindSafe for Alloc
impl Send for Alloc
impl Sync for Alloc
impl Unpin for Alloc
impl UnsafeUnpin for Alloc
impl UnwindSafe for Alloc
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