updated documentation to have mermaid diagrams; updated AGENTS.md to note that all future diagrams should be mermaid diagrams first with text-based diagrams as fallback where not applicable
CI / Detect changed paths (pull_request) Successful in 6s
CI / Odin unit tests and build (pull_request) Successful in 1m23s
CI / API unit tests and lint (pull_request) Has been skipped
CI / Infra unit tests, vet, and preview (pull_request) Successful in 1m22s

This commit is contained in:
2026-09-06 14:28:48 -06:00
parent 8c74efcedb
commit 3803787fe8
9 changed files with 133 additions and 41 deletions
@@ -105,19 +105,28 @@ These are the "thou shalt" rules for keeping buffers compatible:
## Reading a buffer (conceptual)
Buffer layout:
```mermaid
flowchart LR
subgraph BUF["bytes: &[u8]"]
O["uoffset<br/>root table offset"]
FI["file_identifier<br/>(optional)"]
D["tables · vtables · data"]
end
O --> FI --> D
```
bytes: &[u8]
┌─────────────────────────────┐
│ uoffset (root table offset) │
│ file_identifier (optional) │
│ ... tables, vtables, data ...│
└─────────────────────────────┘
Access sequence — each field is a few offset dereferences and a read:
root = follow(bytes) // jump to root table via uoffset
vtable = root - root.vtable_off // locate vtable for this table
field_ra = vtable.slot_ra != 0 // present?
if present: ra = read_f64(bytes, root + slot_ra)
```mermaid
flowchart TD
R["root = follow(bytes)<br/>jump to root table via uoffset"]
V["vtable = root root.vtable_off<br/>locate vtable for this table"]
Q{"field slot present?"}
R --> V --> Q
Q -- "no" --> DEF["use schema default"]
Q -- "yes" --> RD["ra = read_f64(bytes, root + slot_ra)"]
```
There is **no parsing loop**. Each accessor is a few offset dereferences and a