pub fn write_array<F>(
out: &mut Vec<u8>,
elem_alignment: usize,
elem_fixed: bool,
n: usize,
write_elem: F,
) -> Result<()>Expand description
Appends n array elements with normal-form framing to out.
write_elem(out, i) appends element i. This function writes the padding
and the framing-offset area. The framing is the same as the framing that
to_bytes writes.
The other parameters describe the element type:
elem_alignment: the alignment of the element type, in bytes. Ifelem_fixedisfalse, the function pads to it before each element.elem_fixed:trueif the element type has a fixed size. Fixed-size elements pack back to back with no padding and no framing offsets.n: the number of elements.
A caller with its own element storage can write the array framing with this function. An example is the owned field arrays of an ostree object. The caller needs no collected element references.
ยงErrors
The first error that write_elem returns, unchanged. The function has no
error of its own.