Repository navigation
v1.0.0
Pure-Mojo FlatBuffers v1.0.0
First stable release of the pure-Mojo FlatBuffers binary format encoder/decoder.
Features
- FlatBufferBuilder: back-to-front prepend model with automatic buffer growth
- Scalars:
prepend_u8/u16/u32/u64/i16/i32/i64/f32/f64/bool - Strings:
create_string(UTF-8, null-terminated) - Vectors:
create_vector_u8/u32/i32/offsets - Tables:
start_table,add_field_*,end_tablewith vtable deduplication finish(root)→ finalList[UInt8]buffer
- Scalars:
- FlatBuffersReader: zero-copy slot-index navigation over a finished buffer
- Scalar reads with configurable defaults for absent fields
- String and offset reads (raise on absent)
- Vector navigation:
read_vector,vector_len,vec_u8/u32/i32/f32/f64/offset/string - Nested tables, deeply nested traversal, unions
- Safety: bounds checks on all reads, vtable size validation, string length validation, vector index bounds checking
- 58 tests, all passing on CI
Usage
from flatbuffers import FlatBufferBuilder, FlatBuffersReader
var b = FlatBufferBuilder()
var soff = b.create_string("hello")
b.start_table()
b.add_field_i32(0, Int32(42))
b.add_field_offset(1, soff)
var root = b.end_table()
var buf = b.finish(root)
var r = FlatBuffersReader(buf)
var tp = r.root()
var val = r.read_i32(tp, 0) # 42
var msg = r.read_string(tp, 1) # "hello"