def encode.flags
bend-kit-http2@0.4.0.0 · http2.bend:249
import bend-kit-http2@0.4.0.0/http2.bend as Http2
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
249def encode.flags(ok: Bool, +kind: U32, +flags: U32, +stream: U32, payload: Bytes.Bytes) -> Result<&1, &1, Error, Bytes.Bytes>:
250 match ok:
251 case False{}:
252 Fail{Error{1, True{}, 0}}
253 case True{}:
254 Bytes.Bytes{+len, src} = payload
255 encode.buffer(Bytes.set.u32be(Bytes.set(Bytes.set(Bytes.put(Bytes.new((len + 9 : U32)), 0, 3, True{}, len), 3, kind), 4, flags), 5, stream), src, len)