def serve.stream.one
bend-kit-http@0.38.2.0 · http.bend:6546
import bend-kit-http@0.38.2.0/http.bend as Http
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
6546
6547def serve.stream.one(~S: Type, ~piece: S -> Bytes.Bytes -> IO(S & Bool), drop: Bool, state: S, b: Bytes.Bytes) -> IO(S & Bool):
6548 match drop:
6549 case True{}:
6550 IO.pure(S & Bool, (state, True{}))
6551 case False{}:
6552 Bytes.Bytes{+len, buf} = b
6553 serve.stream.nonempty(~S, ~piece, U32.is_eq(len, 0), state, Bytes.Bytes{len, buf})