pub struct LockedHeap(/* private fields */);
Implementations§
Source§impl LockedHeap
impl LockedHeap
pub const fn empty() -> LockedHeap
Sourcepub unsafe fn new(heap_bottom: *mut u8, heap_size: usize) -> LockedHeap
pub unsafe fn new(heap_bottom: *mut u8, heap_size: usize) -> LockedHeap
Creates a new heap with the given bottom
and size
.
The heap_bottom
pointer is automatically aligned, so the bottom()
method might return a pointer that is larger than heap_bottom
after construction.
The given heap_size
must be large enough to store the required
metadata, otherwise this function will panic. Depending on the
alignment of the hole_addr
pointer, the minimum size is between
2 * size_of::<usize>
and 3 * size_of::<usize>
.
§Safety
The bottom address must be valid and the memory in the
[heap_bottom, heap_bottom + heap_size)
range must not be used for anything else.
This function is unsafe because it can cause undefined behavior if the given address
is invalid.
The provided memory range must be valid for the 'static
lifetime.
Trait Implementations§
Source§impl Deref for LockedHeap
impl Deref for LockedHeap
Source§impl GlobalAlloc for LockedHeap
impl GlobalAlloc for LockedHeap
Source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given
layout
. Read moreAuto Trait Implementations§
impl !Freeze for LockedHeap
impl !RefUnwindSafe for LockedHeap
impl Send for LockedHeap
impl Sync for LockedHeap
impl Unpin for LockedHeap
impl UnwindSafe for LockedHeap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more