Skip to main content

size_bound

Function size_bound 

Source
pub const fn size_bound(
    fields: &'static [Field],
    version: EncodingVersion,
    current_alignment: usize,
) -> SizeBound
Expand description

Walk fields from current_alignment, returning the size bound of the struct they describe.

The returned bytes is an ABSOLUTE offset — the position after the last field, measured from the same origin current_alignment was measured from — so a nested struct composes by being handed the parent’s current offset. Subtract the starting offset if a length is what you want.

Excludes the encapsulation header; see max_serialized_size.