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.
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
| Definitions | 1 |
|---|---|
| Public names | 2 |
| Members | 0 |
| Version | 26.7.0 |
| Revision | daab053ee433 |