Expand description
The binary form — what the build compiles content to and the runtime and the Java hosts read, like NBT:
"YOGD" version:u8
strings: varint count, then each as varint length + UTF-8
root valueA value is a tag byte and its payload; every string (map keys too) is an index into the table, so repeated keys and ids cost one varint each.
| Tag | Value | Payload |
|---|---|---|
| 0 | null | — |
| 1, 2 | false, true | — |
| 3 | int | zigzag varint |
| 4 | float | f64, little-endian |
| 5 | string | string |
| 6 | list | varint count, values |
| 7 | map | varint count, (key string, value) pairs |
| 8 | ref | kind string, id string |
| 9 | tag | kind string, id string |
| 10 | resource | set string, key string |
| 11 | text | string |
| 12 | image | string |
| 13 | color | u32, little-endian (0xAARRGGBB) |
| 14 | translation key | string |
Varints are LEB128. Decoding checks every length against the input, so malformed bytes are an error, never a panic or a huge allocation.
Structs§
- Decode
Error - Malformed binary data.
- Writer
- Writes the binary form piece by piece, from data that isn’t a
Value— nothing is built or copied on the way; strings are borrowed untilWriter::finish. A map or list is given its length, then that many entries (keythen a value) or values.
Constants§
Functions§
- decode
- Reads the binary form.
- decode_
ref - Reads the binary form borrowed: every string points into
bytes, lists and maps go inarena— nothing is copied. What a schema reads fastest (crate::read_bytes). - encode
valuein the binary form.