pub struct Heap { /* private fields */ }Expand description
A first-class heap (plan §5.14): Drop runs mi_heap_delete semantics
(blocks migrate to the thread’s backing heap and stay valid) unless built
with Heap::new_destroyable, where Drop releases every block at once.
The destroyable form inherits C’s contract: callers must not touch its
blocks after drop (a lifetime-carrying Allocator impl that makes this
unrepresentable is the planned follow-up once allocator_api stabilizes).
Implementations§
Source§impl Heap
impl Heap
Sourcepub fn new_destroyable() -> Heap
pub fn new_destroyable() -> Heap
New heap; dropped ⇒ every allocation is released wholesale (arena-style teardown).
Sourcepub fn alloc(&self, layout: Layout) -> Option<NonNull<u8>>
pub fn alloc(&self, layout: Layout) -> Option<NonNull<u8>>
Allocate layout, borrowing the heap (so the block cannot outlive it).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Heap
impl !Send for Heap
impl !Sync for Heap
impl !UnwindSafe for Heap
impl Freeze for Heap
impl Unpin for Heap
impl UnsafeUnpin for Heap
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