pub struct FrameAllocator { /* private fields */ }
Expand description

A frame allocator that uses buddy system, requiring a global allocator

Usage

Create a frame allocator and add some frames to it:

use buddy_system_allocator::*;
let mut frame = FrameAllocator::new();
assert!(frame.alloc(1).is_none());

frame.add_frame(0, 3);
let num = frame.alloc(1);
assert_eq!(num, Some(2));
let num = frame.alloc(2);
assert_eq!(num, Some(0));

Implementations

Create an empty frame allocator

Add a range of frame number [start, end) to the allocator

Add a range of frame to the allocator

Alloc a range of frames from the allocator, return the first frame of the allocated range

Dealloc a range of frames [frame, frame+count) from the frame allocator. The range should be exactly the same when it was allocated, as in heap 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.