pub struct Heap { /* private fields */ }Expand description
A persistent map of addresses to cell values.
Implementations§
Source§impl Heap
impl Heap
Sourcepub fn addresses(&self) -> impl Iterator<Item = Address> + '_
pub fn addresses(&self) -> impl Iterator<Item = Address> + '_
All addresses currently live in the heap, in ascending order.
Sourcepub fn alloc(&self, value: Value) -> (Self, Address)
pub fn alloc(&self, value: Value) -> (Self, Address)
Allocate a fresh cell holding value, returning the resulting heap
and the new cell’s address.
Sourcepub fn load(&self, address: Address) -> Option<&Value>
pub fn load(&self, address: Address) -> Option<&Value>
Read the value held at address, or None if the address is dangling.
Trait Implementations§
impl Eq for Heap
impl StructuralPartialEq for Heap
Auto Trait Implementations§
impl Freeze for Heap
impl RefUnwindSafe for Heap
impl Send for Heap
impl Sync for Heap
impl Unpin for Heap
impl UnsafeUnpin for Heap
impl UnwindSafe 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