Runtime

Struct Runtime 

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

State for batching operations and object storage. Every evaluation is a batch - it may just have one operation.

Uses a free-list strategy for heap ID allocation to stay in sync with JS heap. Also stores exported Rust structs and callback functions.

Implementations§

Source§

impl Runtime

Source

pub fn get_next_heap_id(&mut self) -> u64

Get the next heap ID for placeholder allocation. Uses free-list strategy: reuses freed IDs first, then allocates new ones.

Source

pub fn get_next_placeholder_id(&mut self) -> u64

Get the next heap ID for a batched return value placeholder. This also tracks the reserved placeholder count so JS can skip these IDs during nested callback allocations.

Source

pub fn get_next_borrow_id(&mut self) -> u64

Get the next borrow ID from the borrow stack (indices 1-127). The borrow stack grows downward from JSIDX_OFFSET (128) toward 1. Panics if the borrow stack overflows (more than 127 borrowed refs in one operation).

Source

pub fn push_borrow_frame(&mut self)

Push a borrow frame before a nested operation that may use borrowed refs. This saves the current borrow stack pointer so we can restore it later.

Source

pub fn pop_borrow_frame(&mut self)

Pop a borrow frame after a nested operation completes. This restores the borrow stack pointer to where it was before the nested operation.

Source

pub fn release_heap_id(&mut self, id: u64) -> Option<u64>

Release a heap ID back to the free-list and queue it for JS drop.

Auto Trait Implementations§

§

impl !Freeze for Runtime

§

impl !RefUnwindSafe for Runtime

§

impl !Send for Runtime

§

impl !Sync for Runtime

§

impl Unpin for Runtime

§

impl !UnwindSafe for Runtime

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.