def dispatch

bendonnect-rpc@0.1.0.0 · src/pbjson.bend:399

import bendonnect-rpc@0.1.0.0/src/pbjson.bend as Pbjson
import Base

399# The number of the field whose accepted key equals k, or 0 for an unknown key. Typical use:
400# `M.set(m, Pj.dispatch(k, M.json_keys()), v)` where M.set destructures m, then matches on its U32 parameter.
401def dispatch(+k: String, table: List<&2, JKey>) -> U32:
402  match table:
403    case Nil{}:
404      0
405    case Con{JKey{+name, +num}, t}:
406      Bool.pick(U32, String.eq(k, name), num, dispatch(k, t))

Uses (6)

Used by (0)

No other definition uses this definition.