Enum tvix_eval::vm::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.
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§
Auto Trait Implementations§
impl Freeze for VMRequest
impl !RefUnwindSafe for VMRequest
impl !Send for VMRequest
impl !Sync for VMRequest
impl Unpin for VMRequest
impl !UnwindSafe for VMRequest
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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