pub struct FixedSizeBlockAllocator { /* private fields */ }

Implementations§

Creates an empty FixedSizeBlockAllocator.

Initialize the allocator with the given heap bounds.

This function is unsafe because the caller must guarantee that the given heap bounds are valid and that the heap is unused. This method must be called only once.

Allocates a chunk of the given size with the given alignment. Returns a pointer to the beginning of that chunk if it was successful. Else it returns a null pointer.

Allocator first tries to find the smallest block size that is greater or equal to the required size. If a block of that size is available then it is returned, otherwise it tries to allocate from the fallback allocator.

Frees the given allocation. ptr must be a pointer returned by a call to the allocate function with identical size and alignment. Undefined behavior may occur for invalid arguments, thus this function is unsafe.

If the allocation returned is one of the fixed block sizes, then it is returned to the head of the block list. Otherwise, it is deallocated using the fallback allocator.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.