zigar.function.Generator(T) - chung-leong/zigar GitHub Wiki

Define a generator type that will act as an interface to a JavaScript async generator object. When yield() is called with a value, the generate returns a value on the JavaScript side. When the function is given an error instead, then the generator throws.

Arguments:

  • T: type
    Payload type. Must be an optional type.

Struct fields:

  • ptr: ?*anyopaque
    Optional opaque pointer that gets passed to callback. Default to null.
  • callback *const fn (?*anyopaque, T) void
    Pointer to callback function that's called by yield().

Constants:

  • payload = T

Functions:


Generator