Trait acid_alloc::BackingAllocator
source · [−]pub trait BackingAllocator: Sealed {
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout);
}
Expand description
Types which provide memory which backs an allocator.
This is a supertrait of Allocator
, and is implemented by the following types:
- The
Raw
marker type indicates that an allocator is not backed by another allocator. This is the case when constructing the allocator from raw pointers. Memory used by this allocator can be reclaimed using.into_raw_parts()
. - The
Global
marker type indicates that an allocator is backed by the global allocator. The allocator will free its memory on drop. - Any type
A
which implementsAllocator
indicates that an allocator is backed by an instance ofA
. The allocator will free its memory on drop.
Required Methods
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
Deallocates the memory referenced by ptr
.
Safety
ptr
must denote a block of memory currently allocated via this allocator, andlayout
must fit that block of memory.