Enum tvix_eval::generators::VMRequest

source ·
pub enum VMRequest {
Show 21 variants ForceValue(Value), DeepForceValue(Value), WithValue(usize), CapturedWithValue(usize), NixEquality(Box<(Value, Value)>, PointerEquality), StackPush(Value), StackPop, StringCoerce(Value, CoercionKind), Call(Value), EnterLambda { lambda: Rc<Lambda>, upvalues: Rc<Upvalues>, span: Span, }, EmitWarning(EvalWarning), EmitWarningKind(WarningKind), ImportCacheLookup(PathBuf), ImportCachePut(PathBuf, Value), PathImport(PathBuf), OpenFile(PathBuf), PathExists(PathBuf), ReadDir(PathBuf), Span, TryForce(Value), ReadFileType(PathBuf),
}
Expand description

Messages that can be sent from generators to the VM. In most cases, the VM will suspend the generator when receiving a message and enter some other frame to process the request.

Responses are returned to generators via the [GeneratorResponse] type.

Variants§

§

ForceValue(Value)

Request that the VM forces this value. This message is first sent to the VM with the unforced value, then returned to the generator with the forced result.

§

DeepForceValue(Value)

Request that the VM deep-forces the value.

§

WithValue(usize)

Request the value at the given index from the VM’s with-stack, in forced state.

The value is returned in the ForceValue message.

§

CapturedWithValue(usize)

Request the value at the given index from the captured with-stack, in forced state.

§

NixEquality(Box<(Value, Value)>, PointerEquality)

Request that the two values be compared for Nix equality. The result is returned in the ForceValue message.

§

StackPush(Value)

Push the given value to the VM’s stack. This is used to prepare the stack for requesting a function call from the VM.

The VM does not respond to this request, so the next message received is Empty.

§

StackPop

Pop a value from the stack and return it to the generator.

§

StringCoerce(Value, CoercionKind)

Request that the VM coerces this value to a string.

§

Call(Value)

Request that the VM calls the given value, with arguments already prepared on the stack. Value must already be forced.

§

EnterLambda

Request a call frame entering the given lambda immediately. This can be used to force thunks.

Fields

§lambda: Rc<Lambda>
§upvalues: Rc<Upvalues>
§span: Span
§

EmitWarning(EvalWarning)

Emit a runtime warning (already containing a span) through the VM.

§

EmitWarningKind(WarningKind)

Emit a runtime warning through the VM. The span of the current generator is used for the final warning.

§

ImportCacheLookup(PathBuf)

Request a lookup in the VM’s import cache, which tracks the thunks yielded by previously imported files.

§

ImportCachePut(PathBuf, Value)

Provide the VM with an imported value for a given path, which it can populate its input cache with.

§

PathImport(PathBuf)

Request that the VM imports the given path through its I/O interface.

§

OpenFile(PathBuf)

Request that the VM opens the specified file and provides a reader.

§

PathExists(PathBuf)

Request that the VM checks whether the given path exists.

§

ReadDir(PathBuf)

Request that the VM reads the given path.

§

Span

Request a reasonable span from the VM.

§

TryForce(Value)

Request evaluation of builtins.tryEval from the VM. See [VM::catch_result] for an explanation of how this works.

§

ReadFileType(PathBuf)

Request the VM for the file type of the given path.

Trait Implementations§

source§

impl Display for VMRequest

Human-readable representation of a generator message, used by observers.

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToSmolStr for T
where T: Display + ?Sized,

source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V