Skip to main content

Module reader

Module reader 

Source
Expand description

Low-level MessagePack binary reader: tag parsing, value skipping, and typed reads.

All functions operate on &[u8] with explicit offsets. Zero allocation, zero copy. Returns None on truncated/invalid data — never panics.

Functions§

array_header
Return the number of elements and the offset of the first element, for the array starting at offset. Returns None if not an array.
map_header
Return the number of key-value pairs and the offset of the first pair, for the map starting at offset. Returns None if not a map.
read_bool
Read a boolean from the value at offset.
read_f64
Read an f64 from the value at offset. Handles float32, float64, and all integer types (coerced to f64).
read_i64
Read an i64 from the value at offset. Handles all integer types. Floats return None — use read_f64 for those.
read_null
Check if the value at offset is nil.
read_str
Read a string slice from the value at offset. Zero-copy — borrows directly from the input buffer. Returns None for non-string types or invalid UTF-8.
read_value
Read a scalar msgpack value at offset into nodedb_types::Value.
skip_value
Advance past the MessagePack value starting at offset, returning the offset of the next value. Returns None if the buffer is truncated or nesting exceeds MAX_DEPTH.