pub struct Allocator<const SMALLBINS_AMOUNT: usize = DEFAULT_SMALLBINS_AMOUNT, const ALIGNMENT_SUB_BINS_AMOUNT: usize = DEFAULT_ALIGNMENT_SUB_BINS_AMOUNT>where
    SmallestTypeWhichHasAtLeastNBitsStruct<ALIGNMENT_SUB_BINS_AMOUNT>: SmallestTypeWhichHasAtLeastNBitsTrait,
{ /* private fields */ }
Expand description

A linked list memory allocator.

This allocator allows configuring the amount of smallbins and alignment sub-bins that it uses. For more information about this value, read the crate’s top level documentation.

Implementations

Creates an empty heap allocator without any heap memory region, which will always return null on allocation requests.

To intiialize this allocator, use the init method.

Checks if the heap memory region was already initialized by calling init.

Initializes the heap allocator with the given memory region.

Safety

If the allocator was already initialized, this function will panic.

The Allocator on which this was called must not be moved, and its address in memory must not change, otherwise undefined behaviour will occur. This is because the heap region now contains pointers to fields of this struct, and if this struct will move, the address of its fields will change, and those pointers will now be invalid.

The provided memory region must be valid and non-null, and must not be used by anything else.

If after aligning the start and end addresses, the size of the heap is 0, the function panics.

Allocates memory.

Deallocates memory.

Resizes an allocation previously returned from alloc or realloc. The alignment of the content will stay the same.

Trait Implementations

Formats the value using the given formatter. Read more

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.