Struct HeapManager

Source
pub struct HeapManager { /* private fields */ }
Expand description

Concrete implementation of heap operations for the VM

Wraps the low-level Heap and provides high-level heap management functionality for object allocation and memory operations.

Implementations§

Source§

impl HeapManager

Source

pub fn new() -> Self

Creates a new heap manager with an empty heap

Initializes the heap manager with a fresh heap ready for object allocation and memory management.

Source

pub fn heap(&self) -> &Heap

Gets read-only access to the underlying heap

Provides access to the heap for inspection and debugging without allowing modifications.

Source

pub fn heap_mut(&mut self) -> &mut Heap

Gets mutable access to the underlying heap

Provides direct access to the heap for advanced operations and testing purposes.

Trait Implementations§

Source§

impl HeapOperations for HeapManager

Source§

fn alloc_object(&mut self) -> HeapHandleId

Allocates a new object on the heap Read more
Source§

fn alloc_array(&mut self) -> HeapHandleId

Allocates a new array on the heap Read more
Source§

fn alloc_function( &mut self, bytecode: Bytecode, arg_count: ArgIndex, local_count: LocalIndex, ) -> HeapHandleId

Allocates a new function on the heap Read more
Source§

fn get_object_property(&self, handle: HeapHandleId, key: &str) -> Option<&Value>

Gets a property value from an object Read more
Source§

fn set_object_property( &mut self, handle: HeapHandleId, key: String, value: Value, )

Sets a property value on an object Read more
Source§

fn set_array_element( &mut self, handle: HeapHandleId, index: ArraySize, value: Value, )

Sets an element in an array Read more
Source§

fn get_heap(&self) -> &Heap

Gets a reference to the underlying heap Read more
Source§

fn get_array_element( &self, _handle: HeapHandleId, _index: ArraySize, ) -> Option<&Value>

Gets an element from an array Read more
Source§

fn has_object_property(&self, handle: HeapHandleId, key: &str) -> bool

Checks if an object has a specific property Read more
Source§

fn get_array_length(&self, _handle: HeapHandleId) -> usize

Gets the length of an array Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.