solana_program::borsh0_10

Function get_instance_packed_len

source
pub fn get_instance_packed_len<T: BorshSerialize>(
    instance: &T,
) -> Result<usize, Error>
👎Deprecated since 1.18.0: Please upgrade to Borsh 1.X and use borsh1::get_instance_packed_len instead
Expand description

Get the packed length for the serialized form of this object instance.

Useful when working with instances of types that contain a variable-length sequence, such as a Vec or HashMap. Since it is impossible to know the packed length only from the type’s schema, this can be used when an instance already exists, to figure out how much space to allocate in an account.