Narra

Reference

std/coroutine

std/coroutine

Resume a generator by hand and send values into it.

narra
import * as Co from "std/coroutine"

The guide teaches it in chapter 12, Generators.

This page is generated by scripts/std/generate.nra from narrac query --json interface std/coroutine. Do not edit it.

Types

Step

narra
export enum Step<Out> derives Show, Equatable {
  Yielded(value: Out)
  Done
  Panicked(message: string)
}

Functions: resumeGenerator, resumeCoroutine.

Functions

resumeGenerator

narra
export function resumeGenerator<T, effect E>(mutable g: Generator<T> uses E): Step<T> uses E, alloc

Effects: E, alloc.

resumeCoroutine

narra
export function resumeCoroutine<In, Out, effect E>(mutable g: Coroutine<In, Out> uses E, input: In): Step<Out> uses E, alloc

Effects: E, alloc.