Skip to main content

Machine

Struct Machine 

Source
pub struct Machine<'a, H: Host> { /* private fields */ }
Expand description

The production bytecode interpreter.

Implementations§

Source§

impl<'a, H: Host> Machine<'a, H>

Source

pub fn ordinary_number_to_string(number: f64) -> String

Source

pub fn same_value_zero(&self, left: Value, right: Value) -> bool

Source§

impl<'a, H: Host> Machine<'a, H>

Source

pub fn new( program: &'a Program<Verified>, host: &'a mut H, limits: Limits, ) -> Self

Source

pub fn run(self) -> Result<Execution, RuntimeError>

Source

pub fn evaluate(&mut self) -> Result<Execution, RuntimeError>

Evaluates the program without draining queued microtasks.

The machine remains available for an explicit Self::drain_microtasks checkpoint.

Source

pub fn run_one_expired_timer(&mut self) -> Result<TimerRun, RuntimeError>

Runs at most one expired live timer callback.

This explicit checkpoint never drains microtasks. Expiry reports only advance a monotonic watermark; visible delivery is ordered by the machine-owned (deadline, sequence) key.

Source

pub fn wait_for_timer_expiry(&mut self) -> Result<bool, RuntimeError>

Blocks in the host provider until an expiry report is available. Returns whether at least one live timer became ready.

Source

pub fn has_pending_timers(&self) -> bool

Returns whether any machine-owned live timer remains.

Source

pub fn drain_microtasks(&mut self) -> Result<MicrotaskDrain, RuntimeError>

Runs queued microtasks in FIFO order until the queue is empty.

Jobs queued by another job run in the same checkpoint. Promise callback throws settle their derived promises. Throws from queueMicrotask callbacks are returned in MicrotaskDrain::uncaught.

Auto Trait Implementations§

§

impl<'a, H> !UnwindSafe for Machine<'a, H>

§

impl<'a, H> Freeze for Machine<'a, H>

§

impl<'a, H> RefUnwindSafe for Machine<'a, H>
where H: RefUnwindSafe,

§

impl<'a, H> Send for Machine<'a, H>
where H: Send,

§

impl<'a, H> Sync for Machine<'a, H>
where H: Sync,

§

impl<'a, H> Unpin for Machine<'a, H>

§

impl<'a, H> UnsafeUnpin for Machine<'a, H>

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.