def packed.chunk.size

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

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

76# what a chunk-size line says, acted on with the octets after it
77def packed.chunk.size(b: Bytes.Bytes, +d: U32, +len: U32,
78  acc: List<&1, Bytes.Bytes>, z: Http.Size,
79  go: Bytes.Bytes -> U32 -> List<&1, Bytes.Bytes> -> Parts) -> Parts:
80  match z:
81    case Http.SizeBad{why}:
82      Bad{why}
83    case Http.SizeLast{}:
84      Parts{acc}
85    case Http.SizeData{+n}:
86      packed.chunk.data(b, d, n, acc,
87        Bool.not(Nat.is_lt(U32.to_nat((len - d : U32)), Nat.add(n, 2n))), go)

Uses (11)

Used by (1)