Expand description
This module implements generator logic for the VM. Generators are functions used during evaluation which can suspend their execution during their control flow, and request that the VM do something.
This is used to keep the VMโs stack size constant even when evaluating deeply nested recursive data structures.
We implement generators using the genawaiter
crate.
Structsยง
- Gen
- This is a generator which stores its state on the heap.
Enumsยง
- Generator
State ๐ - States that a generator can be in while being driven by the VM.
- VMRequest
- 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.
- VMResponse
- Responses returned to generators from the VM.
Functionsยง
- call_
functor ๐ - Call the given value as if it was an attribute set containing a functor. The arguments must already be prepared on the stack when a generator frame from this function is invoked.
- check_
equality ๐ - Ask the VM to compare two values for equality.
- emit_
warning ๐ - Emit a fully constructed runtime warning.
- emit_
warning_ kind - Emit a runtime warning with the span of the current generator.
- pin_
generator - Helper function to provide type annotations which are otherwise difficult to infer.
- request_
call - Call the given value as a callable. The argument(s) must already be prepared on the stack.
- request_
call_ with - Helper function to call the given value with the provided list of arguments. This uses the StackPush and Call messages under the hood.
- request_
deep_ force - Deep-force any value and return the evaluated result from the VM.
- request_
enter_ ๐lambda - Request that the VM enter the given lambda.
- request_
force - Force any value and return the evaluated result from the VM.
- request_
import_ ๐cache_ lookup - Request a lookup in the VMโs import cache.
- request_
import_ ๐cache_ put - Request that the VM populate its input cache for the given path.
- request_
open_ file - Request that the VM open a std::io::Read for the specified file.
- request_
path_ ๐exists - request_
path_ ๐import - Request that the VM import the given path.
- request_
read_ ๐dir - request_
read_ ๐file_ type - request_
span ๐ - request_
stack_ pop - Request that the VM pop a value from the stack and return it to the generator.
- request_
stack_ push - Request that the VM place the given value on its stack.
- request_
string_ coerce - request_
try_ ๐force - Force a value