pub struct MemoryAllocator { /* private fields */ }Implementations§
Source§impl MemoryAllocator
impl MemoryAllocator
pub fn new() -> Self
pub fn allocate(&mut self, size: MemorySize) -> *mut u8
Sourcepub unsafe fn deallocate(&mut self, ptr: *mut u8, size: MemorySize)
pub unsafe fn deallocate(&mut self, ptr: *mut u8, size: MemorySize)
§Safety
The caller must ensure that:
ptris a valid pointer that was previously allocated by this allocatorsizematches the size that was used when allocatingptrptris not null
pub fn get_stats(&self) -> AllocatorStats
pub fn reset_stats(&mut self)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemoryAllocator
impl RefUnwindSafe for MemoryAllocator
impl Send for MemoryAllocator
impl Sync for MemoryAllocator
impl Unpin for MemoryAllocator
impl UnwindSafe for MemoryAllocator
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