pub struct EspHeap { /* private fields */ }Implementations§
source§impl EspHeap
impl EspHeap
sourcepub const fn empty() -> EspHeap
pub const fn empty() -> EspHeap
Crate a new UNINITIALIZED heap allocator
You must initialize this heap using the
init method before using the
allocator.
sourcepub unsafe fn init(&self, heap_bottom: *mut u8, size: usize)
pub unsafe fn init(&self, heap_bottom: *mut u8, size: usize)
Initializes the heap
This function must be called BEFORE you run any code that makes use of the allocator.
heap_bottom is a pointer to the location of the bottom of the heap.
size is the size of the heap in bytes.
Note that:
-
The heap grows “upwards”, towards larger addresses. Thus
end_addrmust be larger thanstart_addr -
The size of the heap is
(end_addr as usize) - (start_addr as usize). The allocator won’t use the byte atend_addr.
Safety
Obey these or Bad Stuff will happen.
- This function must be called exactly ONCE.
size > 0
Trait Implementations§
source§impl GlobalAlloc for EspHeap
impl GlobalAlloc for EspHeap
source§unsafe fn alloc(&self, layout: Layout) -> *mut u8
unsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocate memory as described by the given
layout. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for EspHeap
impl Send for EspHeap
impl Sync for EspHeap
impl Unpin for EspHeap
impl UnwindSafe for EspHeap
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