def strs

bend-kit-postgres@0.3.0.0 · codec.bend:426

import bend-kit-postgres@0.3.0.0/codec.bend as Codec
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

426# Each string takes a byte, so fuel of the bytes left is enough.
427def strs(f: Nat, s: Loop<Bytes.Bytes, Bytes.Bytes>) -> Cur & List<&1, Bytes.Bytes>:
428  match f:
429    case 0n:
430      loop.end(Bytes.Bytes, Bytes.Bytes, s)
431    case 1n+p:
432      match s:
433        case Go{c, m, acc}:
434          strs(p, strs.read(Con{m, acc}, cstr(c)))
435        case Stop{c, acc}:
436          (c, List.reverse(&1, Bytes.Bytes, acc))

Uses (11)

Used by (1)