Trait Allocator

Source
pub unsafe trait Allocator {
    // Required methods
    fn allocate(&self, layout: Layout) -> Option<NonNull<u8>>;
    unsafe fn deallocate(&self, pointer: *mut u8, layout: Layout);
    unsafe fn reallocate(
        &self,
        pointer: *mut u8,
        oldSize: usize,
        layout: Layout,
    ) -> Option<NonNull<u8>>;

    // Provided methods
    unsafe fn allocate_aligned(&self, layout: Layout) -> Option<NonNull<u8>> { ... }
    unsafe fn deallocate_aligned(&self, pointer: *mut u8, layout: Layout) { ... }
}

Required Methods§

Source

fn allocate(&self, layout: Layout) -> Option<NonNull<u8>>

Source

unsafe fn deallocate(&self, pointer: *mut u8, layout: Layout)

Source

unsafe fn reallocate( &self, pointer: *mut u8, oldSize: usize, layout: Layout, ) -> Option<NonNull<u8>>

Provided Methods§

Source

unsafe fn allocate_aligned(&self, layout: Layout) -> Option<NonNull<u8>>

Source

unsafe fn deallocate_aligned(&self, pointer: *mut u8, layout: Layout)

Implementations on Foreign Types§

Source§

impl<A: Allocator> Allocator for &RefCell<A>

Source§

fn allocate(&self, layout: Layout) -> Option<NonNull<u8>>

Source§

unsafe fn deallocate(&self, pointer: *mut u8, layout: Layout)

Source§

unsafe fn reallocate( &self, pointer: *mut u8, oldSize: usize, layout: Layout, ) -> Option<NonNull<u8>>

Source§

impl<A: Allocator> Allocator for Mutex<A>

Source§

fn allocate(&self, layout: Layout) -> Option<NonNull<u8>>

Source§

unsafe fn deallocate(&self, pointer: *mut u8, layout: Layout)

Source§

unsafe fn reallocate( &self, pointer: *mut u8, oldSize: usize, layout: Layout, ) -> Option<NonNull<u8>>

Implementors§