ChainableAlloc

Trait ChainableAlloc 

Source
pub unsafe trait ChainableAlloc {
    // Required method
    fn claims(&self, ptr: *mut u8, layout: Layout) -> bool;
}
Expand description

A trait representing an allocator that another allocator can be chained to.

§Safety

claims must return true if and only if the allocation belongs to this allocator (as opposed to one further up the chain). This trait is used to decide which allocator to free from when the user calls deallocate() and related functions.

Required Methods§

Source

fn claims(&self, ptr: *mut u8, layout: Layout) -> bool

Tests whether a certain allocation belongs to this allocator. This is called when using deallocate() and related functions in order to determine which allocator needs to free the pointer.

Implementors§

Source§

impl<const L: usize, const B: usize> ChainableAlloc for Stalloc<L, B>
where Align<B>: Alignment,

SAFETY: Since zero-sized allocations unconditionally succeed, it can be assumed that a zero-sized allocation was allocated by this Stalloc. Otherwise, check whether the pointer is contained within this Stalloc’s buffer.

Source§

impl<const L: usize, const B: usize> ChainableAlloc for SyncStalloc<L, B>
where Align<B>: Alignment,

Source§

impl<const L: usize, const B: usize> ChainableAlloc for UnsafeStalloc<L, B>
where Align<B>: Alignment,