Skip to main content

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.

Also stores exported Rust structs and callback functions.

Implementations§

Source§

impl Runtime

Source

pub fn observe_js_heap_id(&mut self, id: u64)

Record a JS-allocated heap ID from a response.

Source

pub fn get_next_placeholder_id(&mut self) -> u64

Get the next heap ID for a return value placeholder.

Source

pub fn get_next_inbound_js_heap_id(&mut self) -> u64

Allocate the next ID for a JS object sent without encoding an ID. The ID joins the pending install batch shipped on the next Rust-to-JS message.

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>

Track a heap ID as released and queue it for JS drop when appropriate. Returns the ID when there is no open operation frame to batch it into, signalling the caller to notify JS immediately.

Source

pub fn recycle_heap_id(&mut self, id: u64)

Source

pub fn recycle_heap_id_if_released(&mut self, id: u64) -> bool

Source

pub fn defer_heap_id_recycle_until_flush(&mut self, id: u64)

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> RefFromWasmAbi for T
where T: ?Sized,

Source§

unsafe fn ref_from_abi(js: u32) -> AbiRef<Self>
where Self: Sized + FromAbiId,

Recreate a non-dropping reference anchor from a heap id. Read more
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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = <Self as ErasableGeneric>::Repr>,

Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = <Self as ErasableGeneric>::Repr>,

Source§

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