pub struct Heap<const ORDER: usize> {
pub allocated: usize,
pub freeList: [LinkedList; ORDER],
pub total: usize,
pub user: usize,
}Fields§
§allocated: usize§freeList: [LinkedList; ORDER]§total: usize§user: usizeImplementations§
Source§impl<const ORDER: usize> Heap<ORDER>
impl<const ORDER: usize> Heap<ORDER>
pub unsafe fn add_to_heap(&mut self, start: usize, end: usize)
Sourcepub unsafe fn allocate(
&mut self,
layout: Layout,
) -> Result<NonNull<u8>, AllocationError>
pub unsafe fn allocate( &mut self, layout: Layout, ) -> Result<NonNull<u8>, AllocationError>
Allocate a block of memory large enough to contain size bytes,
and aligned on align. This will return NULL if the align is
greater than MIN_HEAP_ALIGN, if align is not a power of 2, or
if we can’t find enough memory.
All allocated memory must be passed to deallocate with the same
size and align parameter, or else horrible things will happen.
pub unsafe fn deallocate(&mut self, ptr: NonNull<u8>, layout: Layout)
Trait Implementations§
Auto Trait Implementations§
impl<const ORDER: usize> Freeze for Heap<ORDER>
impl<const ORDER: usize> RefUnwindSafe for Heap<ORDER>
impl<const ORDER: usize> Send for Heap<ORDER>
impl<const ORDER: usize> !Sync for Heap<ORDER>
impl<const ORDER: usize> Unpin for Heap<ORDER>
impl<const ORDER: usize> UnwindSafe for Heap<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