Function solana_sdk::borsh::get_instance_packed_len [−][src]
pub fn get_instance_packed_len<T>(instance: &T) -> Result<usize, Error> where
T: BorshSerialize,
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.