pub struct Heap<const ORDER: usize> { /* private fields */ }
Expand description

A heap that uses buddy system with configurable order.

Usage

Create a heap and add a memory region to it:

use buddy_system_allocator::*;
let mut heap = Heap::<32>::empty();
unsafe {
    heap.init(begin, size);
    // or
    heap.add_to_heap(begin, end);
}

Implementations§

Create an empty heap

Create an empty heap

Add a range of memory [start, end) to the heap

Add a range of memory [start, start+size) to the heap

Alloc a range of memory from the heap satifying layout requirements

Dealloc a range of memory from the heap

Return the number of bytes that user requests

Return the number of bytes that are actually allocated

Return the total number of bytes in the heap

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.