Skip to main content

Module wire

Module wire 

Source
Expand description

Public low-level wire primitives for generated code (see crate::codegen). Everything here is bounds-checked and unsafe-free; generated readers/writers compose these with offsets computed at generation time from the deterministic layout algorithm.

Nothing in this module is needed for normal (dynamic) use of the library.

Functions§

alloc_block
Reserve a zeroed, aligned block and return its absolute offset.
alloc_bytes
Reserve n zeroed bytes at the current position, returning their offset.
begin_list
Write a list header (count, then padding so elements start aligned). Returns the list offset to patch into the referencing slot. Elements (count * stride bytes) must be appended immediately after.
charge
Charge bytes against an optional traversal budget. None (the trusted, unbounded path) is a no-op the optimizer removes.
finish_message
Patch the root offset into the header.
list_header
Follow a u32 offset slot at slot to a list header. Returns (elements base, count); elements are stride apart per the schema layout.
message_header
Start a message buffer: header, optional inline schema, padding to 8.
pad_to
patch_u32
pos
push_bool
push_bool_slice
push_f32
push_f64
push_f32_slice
push_f64_slice
push_i8
push_i8_slice
push_i16
push_i32
push_i64
push_i16_slice
push_i32_slice
push_i64_slice
push_u8
push_u8_slice
push_u16
push_u32
push_u64
push_u16_slice
push_u32_slice
push_u64_slice
put_bool
put_f32
put_f64
put_i8
put_i16
put_i32
put_i64
put_u8
put_u16
put_u32
put_u64
read_bool
read_bytes
Follow a u32 offset slot at slot to a length-prefixed blob.
read_bytes_budgeted
read_bytes with the payload charged against the budget first.
read_f32
read_f64
read_i8
read_i16
read_i32
read_i64
read_slice
read_str
Follow a u32 offset slot at slot to a length-prefixed UTF-8 string.
read_str_budgeted
read_str with the payload charged against the budget before it is touched, so a bounded read can never exceed its budget even transiently.
read_u8
read_u16
read_u32
read_u64
set_presence_bit
Set presence bit pos in the bitmap at the start of a struct block.
write_blob
Append a length-prefixed blob (string/bytes payload), returning its offset.