def decode.snap

bend-kit-runner@0.13.0.1 · runner.bend:993

import bend-kit-runner@0.13.0.1/runner.bend as Runner
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

993# The state of a Snap record whose tag is already checked. The decoder must end at the record's end.
994def decode.snap(~A: Data, ~pdec: Bytes.Bytes -> Maybe<&2, A>, b: Bytes.Bytes) -> Maybe<&2, State<A>>:
995  Bytes.Bytes{+len, buf} = b
996  rd.done(State<A>, len, rd.state(~A, ~pdec, U32.to_nat((len / 4 + 1 : U32)))(Rd{Bytes.Bytes{len, buf}, 4}))

Uses (10)

Used by (1)