Skip to documentation
SLOP

tiny.preserves.PackedTag

Reference tiny.preserves PackedTag

Defined in packed_constants.

The tag byte that starts each encoded value, as an enum over u8, so code that writes encoded bytes by hand names each tag through it.

API (16)

Actions

Public operations.

Fields and members

Public fields and members.

No direct callersNo direct callspacked_constantsTag
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Source: lib/preserves/src/packed/constants.zig:8

zig
/// The tag byte that starts each encoded value, as an enum over `u8`, so code that writes encoded/// bytes by hand names each tag through it. The packed reader rejects a byte outside these fourteen/// values as `UnknownTag`.pub const Tag = enum(u8) {    false_ = 0x80,    true_ = 0x81,    /// The byte 0x84, which closes a record, sequence, set or dictionary. At the start of a value,    /// the packed reader rejects it as `UnexpectedEndMarker`.    end = 0x84,    /// The byte 0x85, which starts an annotation in the binary syntax. The packed writer never    /// writes it, and the packed reader rejects it as `AnnotationNotSupported`.    annotation = 0x85,    /// The byte 0x86, which starts an embedded value. The packed writer writes it before an    /// embedded value's bytes, which come from its type's `encodePacked`. The packed reader rejects    /// it as `EmbeddedNotSupported`, so bytes holding an embedded value never decode.    embedded = 0x86,    /// The byte 0x87, which starts a double: a length of 8, then the double's eight bytes,    /// big-endian.    ieee754 = 0x87,    signed_integer = 0xb0,    string = 0xb1,    byte_string = 0xb2,    symbol = 0xb3,    record = 0xb4,    sequence = 0xb5,    set = 0xb6,    dictionary = 0xb7,    /// Returns the byte value of the tag, for code that writes a tag into a byte buffer.    pub fn byte(self: Tag) u8 {        return @backingInt(self);    }    /// Returns the tag whose byte is `b`, or null otherwise, so the packed reader calls it on each    /// tag byte for the kind of value that follows. `fromByte(t.byte())` returns `t` for every tag.    pub fn fromByte(b: u8) ?Tag {        return switch (b) {            0x80 => .false_,            0x81 => .true_,            0x84 => .end,            0x85 => .annotation,            0x86 => .embedded,            0x87 => .ieee754,            0xb0 => .signed_integer,            0xb1 => .string,            0xb2 => .byte_string,            0xb3 => .symbol,            0xb4 => .record,            0xb5 => .sequence,            0xb6 => .set,            0xb7 => .dictionary,            else => null,        };    }};

Source: lib/preserves/src/root.zig:297

zig
pub const PackedTag = @"packed".Tag;
Called byCallsNo direct callstest sourcelib.preserves.src.packed.constantstest: Tag round-trips through byteprivate sourcelib.preserves.src.packed.readerreadValuePackedTagfromByte
Static calls · unresolved targets: 0 · external targets: 0.

Also reachable as

@"packed".Tag, @"packed".constants.Tag, @"packed".reader.Tag, @"packed".writer.Tag, packed_reader.Tag, packed_writer.Tag.

Audit

Definitions3
Public names24
Members14
Version26.7.0
Revisiondaab053ee433