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.
byte: Returns the byte value of the tag, for code that writes a tag into a byte buffer.fromByte: Returns the tag whose byte isb, or null otherwise, so the packed reader calls it on each tag byte for the kind of value that follows.
Fields and members
Public fields and members.
annotationbyte_stringdictionaryembeddedendfalse_ieee754recordsequencesetsigned_integerstringsymboltrue_
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;Also reachable as
@"packed".Tag, @"packed".constants.Tag, @"packed".reader.Tag, @"packed".writer.Tag, packed_reader.Tag, packed_writer.Tag.
Audit
| Definitions | 3 |
|---|---|
| Public names | 24 |
| Members | 14 |
| Version | 26.7.0 |
| Revision | daab053ee433 |