Trait method lrs::alloc::Allocator::allocate_raw

Allocates a chunk of bytes with the specified properties.

Syntax

unsafe fn allocate_raw(pool: &mut <Self as Allocator>::Pool, size: usize, alignment: usize) -> Result<*mut u8, Errno>

Arguments

NameDescription
pool

The pool from which to draw memory.

size

The size of the allocated object.

alignment

The alignment of the allocated object.

Return value

Returns the allocated object.

Remarks

The alignment must be a power of two or the behavior is undefined. Not all allocators support all alignments. In general, only alignments that are required by the hardware can be satisfied.

If size is zero, the behavior is undefined.