moonbitstack/moonhttp/header does not have a README file

    pub(all) struct Header {
    name : Bytes
    value : Bytes
    } derive(Eq,
    Debug
    )

    One header field: a name and a value, as octets (RFC 9110 ยง5).

    Octets and not strings, for two reasons. A field value is a byte sequence that a receiver only later decides how to read, and gRPC's -bin metadata is binary by design; decoding either to a String on the way past would lose what was sent.

    Both header compressions produce and consume these, so HTTP/2 and HTTP/3 speak of a header list in the same type and nothing has to be converted between them.

    Header::ascii

    fn Header::ascii(self : Header) -> (String, String)

    The field's name and value read back as ASCII.

    Every octet becomes one code point, so this round-trips what of wrote and turns arbitrary bytes into something printable rather than refusing them; a value that is meant to be UTF-8 is the caller's to decode.

    Header::cost

    fn Header::cost(self : Header, overhead? : Int) -> Int

    How many octets the field costs a compressor's table: its two parts and a fixed overhead for the entry itself (RFC 7541 ยง4.1, and RFC 9204 ยง3.2.1 with the same arithmetic).

    Header::equal

    fn Header::equal(Header, Header) -> Bool

    Header::not_equal

    fn Header::not_equal(x : Header, y : Header) -> Bool

    Header::of

    fn Header::of(name : String, value : String) -> Header

    A field from ASCII, which is how a specification writes one and how most code means one. A code point past 0x7f is written as its low octet, so this is for names and values that are ASCII to begin with.

    Header::to_repr

    Source Files

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    ยฉ 2026 mooncakes.io