def rb.buf

bend-kit-http@0.38.2.0 · http.bend:1406

import bend-kit-http@0.38.2.0/http.bend as Http
import Base

1406# Some{left}: a Content-Length body small enough to allocate up front. Larger ones fail at the fetch cap.
1407def rb.buf(rb: Rb) -> Maybe<&2, U32>:
1408  match rb:
1409    case RbLen{+left}:
1410      Bool.pick(Maybe<&2, U32>, Nat.is_lt(fetch.max(), U32.to_nat(left)), None{}, Some{left})
1411    case RbChunk{st}:
1412      None{}
1413    case RbClose{}:
1414      None{}
1415    case RbDone{}:
1416      None{}
1417    case RbBad{}:
1418      None{}

Uses (7)

Used by (1)