def packed.chunk.data

emerging-ezhttp@0.21.0.0 · src/packed.bend:64

import emerging-ezhttp@0.21.0.0/src/packed.bend as Packed
import Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
import emerging-ezhttp@0.21.0.0/src/http.bend as Http

64# a chunk of n octets from d: its octets must all be there, and a CRLF after
65# them
66def packed.chunk.data(b: Bytes.Bytes, +d: U32, +n: Nat,
67  acc: List<&1, Bytes.Bytes>, fits: Bool,
68  go: Bytes.Bytes -> U32 -> List<&1, Bytes.Bytes> -> Parts) -> Parts:
69  match fits:
70    case False{}:
71      Bad{Http.chunk.short()}
72    case True{}:
73      +k = U32.from_nat(n)
74      packed.chunk.ready(packed.text(b, (d + k : U32), 2), d, k, acc, go)

Uses (11)

Used by (1)