Skip to main content

write_union_slot

Function write_union_slot 

Source
pub fn write_union_slot<B>(buffer: &mut B, data_slot: usize, tag: u8) -> usize
where B: Buffer,
Expand description

Write a 5-byte union slot: a 4-byte forward offset followed by a 1-byte discriminant tag.

Union fields in the vtable are field_size = 5 bytes: the first four are a relative offset to the payload, and the fifth is the variant tag that tells the reader which concrete type to deserialize.

Called from both owned_pass2 and view_pass2 in the generated code.