Struct xalloc::bitmap::BitmapAlloc
[−]
[src]
pub struct BitmapAlloc { /* fields omitted */ }
Free space bitmap-based external memory allocator.
See the module-level documentation for more.
Methods
impl BitmapAlloc
[src]
pub fn new(size: usize) -> Self
[src]
Construct a BitmapAlloc
.
pub fn alloc(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
[src]
Alias of alloc_next
.
pub fn alloc_next(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
[src]
Allocate a region of the size size
using a Next-Fit strategy.
The time complexity is linear to the size of the heap.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
size
must not be zero.
pub fn alloc_first(&mut self, size: usize) -> Option<(BitmapAllocRegion, usize)>
[src]
Allocate a region of the size size
using a First-Fit strategy.
The time complexity is linear to the size of the heap.
Returns a handle of the allocated region and its offset if the
allocation succeeds. Returns None
otherwise.
size
must not be zero.
pub fn dealloc_relaxed(&mut self, r: BitmapAllocRegion)
[src]
Deallocate the specified region.
r
must originate from the same instance of BitmapAlloc
. Otherwise,
BitmapAlloc
enters an inconsistent state and possibly panics, but does
not cause an undefined behavior.
Trait Implementations
impl Debug for BitmapAlloc
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for BitmapAlloc
[src]
fn clone(&self) -> BitmapAlloc
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more