Skip to documentation
SLOP

tiny.mprompt.run

Reference tiny.mprompt run

Defined in zig_api.

A caller runs the body to its end in one call, and a handler answers each pause before the body goes on.

Called byCallszig_apirunWithoutContexttest sourcelib.mprompt.src.apitest: typed prompt run preserves erro...test sourcelib.mprompt.src.apitest: typed prompt run returns a Zig ...test sourcelib.mprompt.src.apitest: typed yield passes values throu...test sourcelib.mprompt.src.apitest: typed yield supports tail conti...private sourcelib.mprompt.src.apiRunEnvironmentTypeprivate sourcelib.mprompt.src.apireadSlotprivate sourcelib.mprompt.src.apirequirePointerzig_apirun
Static calls · unresolved targets: 1 · external targets: 1.

Source

Source: lib/mprompt/src/api.zig:391

zig
/// A caller runs the body to its end in one call, and a handler answers each pause before the body/// goes on. The call creates a prompt with a new stacklet, runs `body(prompt, context)` on it, and/// returns what the body returns. The prompt marks where the body entered its stacklet, and the/// body passes it to `yieldWith` to pause back to that point. `context` must be a pointer, and any/// other type is a compile error. An error union passes through: a body that returns an error makes/// `run` return that error. The stacklet comes from the calling thread's cache or from a new/// reservation. The first prompt in a process initializes the runtime with the default/// configuration when `init` has not run. The runtime releases the stacklet when the body returns./// The body pauses with `yieldWith`. `suspendPrompt` is only for bodies started by `SuspendedRun`.pub fn run(    comptime Result: type,    context: anytype,    comptime body: *const fn (*Prompt, @TypeOf(context)) Result,) Result {    const Context = @TypeOf(context);    requirePointer(Context, "run context");    const Environment: type = RunEnvironmentType(Result, Context, body);    var environment: Environment = .{ .context = context };    return readSlot(Result, raw.prompt(Environment.start, &environment));}

Source: lib/mprompt/src/root.zig:64

zig
pub const run = zig_api.run;

Audit

Definitions1
Public names2
Members0
Version26.7.0
Revisiondaab053ee433