Skip to documentation
SLOP

tiny.mprompt.on

Reference tiny.mprompt on

Defined in effect.

Returns a clause that answers an operation with handler under clause kind kind, so a caller writes one per operation in the clauses passed to a typed handle.

Called byCallsNo direct callersprivate sourcelib.mprompt.src.effectHandlerClauseeffectforwardeffecton
Static calls · unresolved targets: 0 · external targets: 0.

Source

Source: lib/mprompt/src/effect.zig:208

zig
/// Returns a clause that answers an operation with `handler` under clause kind `kind`, so a caller/// writes one per operation in the clauses passed to a typed `handle`. A `kind` of `.forward` is a/// compile error that points to `forward()`, and `.null_op` is a compile error. For `tail_noop`,/// `tail`, `abort` and `never`, the handler takes `()`, `(arg)` or `(context, arg)`, and the empty/// form needs a `void` argument. For `scoped_once`, `scoped`, `once` and `multi`, the handler takes/// `(continuation)`, `(continuation, arg)` or `(continuation, context, arg)`, and the one-parameter/// form needs a `void` argument. The `tail_noop` and `tail` handlers return the operation's result,/// and the other kinds return the result type of `handle`. The handler must be a function with a/// declared return type, and a generic handler is a compile error.pub fn on(comptime kind: OperationKind, comptime handler: anytype) HandlerClause(@TypeOf(handler)) {    if (kind == .forward) {        @compileError("use forward() for forwarded operations");    }    if (kind == .null_op) {        @compileError("null operations are only used to terminate raw handler tables");    }    return .{ .kind = kind, .handler = handler };}

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

zig
pub const on = effect.on;

Audit

Definitions1
Public names2
Members0
Version26.7.0
Revisiondaab053ee433