Module generators

Source
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§

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§

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_force
Force any value and return the evaluated result from the VM.
request_open_file
Request that the VM open a std::io::Read for the specified file.
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

Type Aliases§

GenCo