Enum tvix_eval::vm::Frame

source ·
enum Frame {
    CallFrame {
        call_frame: CallFrame,
        span: Span,
    },
    Generator {
        name: &'static str,
        span: Span,
        state: GeneratorState,
        generator: Gen<VMRequest, VMResponse, Pin<Box<dyn Future<Output = Result<Value, ErrorKind>>>>>,
    },
}
Expand description

A frame represents an execution state of the VM. The VM has a stack of frames representing the nesting of execution inside of the VM, and operates on the frame at the top.

When a frame has been fully executed, it is removed from the VM’s frame stack and expected to leave a result Value on the top of the stack.

Variants§

§

CallFrame

CallFrame represents the execution of Tvix bytecode within a thunk, function or closure.

Fields

§call_frame: CallFrame

The call frame itself, separated out into another type to pass it around easily.

§span: Span

Span from which the call frame was launched.

§

Generator

Generator represents a frame that can yield further instructions to the VM while its execution is being driven.

A generator is essentially an asynchronous function that can be suspended while waiting for the VM to do something (e.g. thunk forcing), and resume at the same point.

Fields

§name: &'static str

human-readable description of the generator,

§span: Span

Span from which the generator was launched.

§generator: Gen<VMRequest, VMResponse, Pin<Box<dyn Future<Output = Result<Value, ErrorKind>>>>>

Generator itself, which can be resumed with .resume().

Implementations§

source§

impl Frame

source

pub fn span(&self) -> Span

Auto Trait Implementations§

§

impl Freeze for Frame

§

impl !RefUnwindSafe for Frame

§

impl !Send for Frame

§

impl !Sync for Frame

§

impl Unpin for Frame

§

impl !UnwindSafe for Frame

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V