Store

Trait Store 

Source
pub unsafe trait Store: Sync {
    // Required methods
    unsafe fn alloc(&self, layout: Layout) -> *mut u8;
    unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);

    // Provided methods
    unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { ... }
    unsafe fn realloc(
        &self,
        ptr: *mut u8,
        layout: Layout,
        new_size: usize,
    ) -> *mut u8 { ... }
}
Expand description

This trait is a shim for the GlobalAlloc trait, defined so that we can implement it for std defined types like Vec. See those docs for information on how to implement this trait correctly.

Future versions of this crate may allow for handling allocation failure, but this is currently not supported.

Required Methods§

Source

unsafe fn alloc(&self, layout: Layout) -> *mut u8

Source

unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)

Provided Methods§

Source

unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8

Source

unsafe fn realloc( &self, ptr: *mut u8, layout: Layout, new_size: usize, ) -> *mut u8

Implementors§