def serve.stream.one

bend-kit-http@0.38.5.0 · http.bend:6538

import bend-kit-http@0.38.5.0/http.bend as Http
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes

6538# The piece callback returns True to discard the rest of this request body.
6539def serve.stream.one(~S: Type, ~piece: S -> Bytes.Bytes -> IO(S & Bool), drop: Bool, state: S, b: Bytes.Bytes) -> IO(S & Bool):
6540  match drop:
6541    case True{}:
6542      IO.pure(S & Bool, (state, True{}))
6543    case False{}:
6544      Bytes.Bytes{+len, buf} = b
6545      serve.stream.nonempty(~S, ~piece, U32.is_eq(len, 0), state, Bytes.Bytes{len, buf})

Uses (8)

Used by (1)