Struct mnemos_alloc::heap::HeapGuard
source · pub struct HeapGuard {
aheap: &'static AHeap,
}
Expand description
A guard type that provides mutually exclusive access to the allocator as long as the guard is held.
Fields§
§aheap: &'static AHeap
Implementations§
source§impl HeapGuard
impl HeapGuard
fn get_heap(&mut self) -> &mut Heap
fn clean_allocs(&mut self)
sourcepub fn alloc_box<T>(&mut self, data: T) -> Result<HeapBox<T>, T>
pub fn alloc_box<T>(&mut self, data: T) -> Result<HeapBox<T>, T>
Attempt to allocate a HeapBox using the allocator
If space was available, the allocation will be returned. If not, an error will be returned
sourcepub fn alloc_arc<T>(&mut self, data: T) -> Result<HeapArc<T>, T>
pub fn alloc_arc<T>(&mut self, data: T) -> Result<HeapArc<T>, T>
Attempt to allocate a HeapArc using the allocator
If space was available, the allocation will be returned. If not, an error will be returned
pub fn alloc_box_array_with<T, F>( &mut self, f: F, count: usize ) -> Result<HeapArray<T>, ()>where F: Fn() -> T,
pub fn alloc_fixed_vec<T>( &mut self, capacity: usize ) -> Result<HeapFixedVec<T>, ()>
pub fn alloc_raw(&mut self, layout: Layout) -> Result<NonNull<()>, ()>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for HeapGuard
impl Send for HeapGuard
impl Sync for HeapGuard
impl Unpin for HeapGuard
impl !UnwindSafe for HeapGuard
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