Skip to main content

write_header_with_len

Function write_header_with_len 

Source
pub fn write_header_with_len(
    data: &mut [u8],
    discriminator: u8,
    version: u8,
    flags: u8,
    data_len: u32,
) -> Result<(), ProgramError>
Expand description

Write the full 8-byte header including an explicit data_len value.

Use this when initializing variable-length accounts where the payload size is not implied by the fixed account allocation.