pub fn alloc_and_serialize_variable_len_extension<S: BaseState, V: Extension + VariableLenPack>(
account_info: &AccountInfo<'_>,
new_extension: &V,
overwrite: bool
) -> Result<(), ProgramError>
Expand description
Packs a variable-length extension into a TLV space
This function reallocates the account as needed to accommodate for the change in space, then reallocates in the TLV buffer, and finally writes the bytes.
NOTE: Unlike the reallocate
instruction, this function will reduce the
size of an account if it has too many bytes allocated for the given value.