menu

Generator

import { Generator } from "destack:async";

Generator object.

A generator body runs on its own fiber; each step wakes the body with the consumer request and blocks the consumer until the body yields or returns.

language/library/src/async/generator.ds:17:43
1export class Generator<Y, R = void, N = void> {2    next(value: N | undefined): GeneratorResult<Y, R>;3    return(value: R): GeneratorResult<Y, R>;4}

Members

next(value: N | undefined): GeneratorResult<Y, R>

Advance the generator with one value.

return(value: R): GeneratorResult<Y, R>

Finalize the generator and return the completion value.