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 implements Allocator indicates that an allocator is backed by an instance of A. The allocator will free its memory on drop.

Required Methods

Deallocates the memory referenced by ptr.

Safety
  • ptr must denote a block of memory currently allocated via this allocator, and
  • layout must fit that block of memory.

Implementors