Trait Fallbackable

Source
pub unsafe trait Fallbackable: Allocator {
    // Required methods
    unsafe fn has_allocated(&self, ptr: NonNull<u8>, layout: Layout) -> bool;
    fn allows_fallback(&self, layout: Layout) -> bool;
}
Expand description

§Safety

The allows_fallback function should be pure, i.e. always return same value for same layout.

An implementer of this trait should return true from has_allocated if and only if at least one of the following conditions is satisfied:

Required Methods§

Source

unsafe fn has_allocated(&self, ptr: NonNull<u8>, layout: Layout) -> bool

§Safety

The ptr parameter should denote a memory block, currently allocated by this or any other Allocator.

The layout parameter should fit the memory block denoting by ptr.

Source

fn allows_fallback(&self, layout: Layout) -> bool

Implementations on Foreign Types§

Source§

impl<'a, T: Fallbackable + ?Sized> Fallbackable for &'a T

Source§

unsafe fn has_allocated(&self, ptr: NonNull<u8>, layout: Layout) -> bool

Source§

fn allows_fallback(&self, layout: Layout) -> bool

Implementors§