def encode.of
import bendonnect-rpc@0.1.0.0/src/envelope.bend as Envelopeimport Base
import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes
22# 5-byte header followed by the message.
23def encode.of(+flags: U32, r: Bytes.Bytes & U32) -> Bytes.Bytes:
24 (data, len) = r
25 h1 = Bytes.set(Bytes.new(5), 0, (flags .&. 255 : U32))
26 h2 = Bytes.set.u32be(h1, 1, len)
27 Bytes.append(h2, data)