Skip to main content

Module writer

Module writer 

Source
Expand description

An endian-aware byte writer, the builders’ only primitive.

Fields. Every 4- and 8-byte integer a writer writes (u32, i32, u64, i64: each count, length, size and offset the builders write, and every other integer of those widths) is a field. While with_fields runs a build on the calling thread, the writers number the fields that build writes, in write order, report each one, and can write another value in place of any of them. G3b’s mutator (crate::mutate) builds the gate’s inputs this way, so a field is changed before anything that follows from it is computed: the bytes a codec compresses, the size of a block, the entry that holds a file. Outside with_fields a writer writes what it is given.

Structs§

ByteWriter
Little- or big-endian bytes, appended.
Field
One field a build wrote (module docs).

Functions§

with_fields
Runs build on this thread with each field it writes numbered from 0 in write order: field n is written as v where overrides holds (n, v) (its low width bytes), and as given otherwise. Returns what build returned and every field it wrote, with the value it was given. A nested call runs its build with a numbering of its own.