Alloc

Trait Alloc 

Source
pub trait Alloc {
    // Required method
    fn alloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>;

    // Provided method
    fn zalloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError> { ... }
}
Expand description

A memory allocation interface.

Required Methods§

Source

fn alloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>

Attempts to allocate a block of memory fitting the given Layout.

§Errors

Provided Methods§

Source

fn zalloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>

Attempts to allocate a zeroed block of memory fitting the given Layout.

§Errors

Implementations on Foreign Types§

Source§

impl Alloc for System

Available on crate feature std only.
Source§

fn alloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>

Source§

fn zalloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>

Source§

impl<A: Alloc + ?Sized> Alloc for &A

Source§

fn alloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>

Source§

fn zalloc(&self, layout: Layout) -> Result<NonNull<u8>, AllocError>

Implementors§