def pr.run

bend-kit-tar@0.3.0.0 · tar.bend:293

import bend-kit-tar@0.3.0.0/tar.bend as Tar
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

293# Each record consumes at least three bytes; leave fuel for the end transition.
294def pr.run(fuel: Nat, r: Bytes.Cursor & Pst) -> Bytes.Cursor & Maybe<&1, Pax>:
295  match fuel:
296    case 0n:
297      (c, st) = r
298      (c, None{})
299    case 1n+f:
300      (c, st) = r
301      match st:
302        case PGo{pax}:
303          pr.run(f, pr.more(pax, Bytes.Cursor.remaining(c)))
304        case PEnd{pax}:
305          (c, Some{pax})
306        case PBad{}:
307          (c, None{})

Uses (9)

Used by (1)