pub struct LockedHeap<const ORDER: usize>(/* private fields */);Expand description
A locked version of Heap
§Usage
Create a locked heap and add a memory region to it:
use base::alloc::heap::*;
let mut heap = LockedHeap::<32>::new();
unsafe {
heap.lock().init(begin, size);
// or
heap.lock().add_to_heap(begin, end);
}Implementations§
Trait Implementations§
Source§impl<const ORDER: usize> GlobalAlloc for LockedHeap<ORDER>
impl<const ORDER: usize> GlobalAlloc for LockedHeap<ORDER>
Source§unsafe fn alloc(&self, layout: StdLayout) -> *mut u8
unsafe fn alloc(&self, layout: StdLayout) -> *mut u8
Allocates memory as described by the given
layout. Read moreAuto Trait Implementations§
impl<const ORDER: usize> !Freeze for LockedHeap<ORDER>
impl<const ORDER: usize> !RefUnwindSafe for LockedHeap<ORDER>
impl<const ORDER: usize> Send for LockedHeap<ORDER>
impl<const ORDER: usize> Sync for LockedHeap<ORDER>
impl<const ORDER: usize> Unpin for LockedHeap<ORDER>
impl<const ORDER: usize> UnwindSafe for LockedHeap<ORDER>
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