borsh

Function max_serialized_size

Source
pub fn max_serialized_size<T: BorshSchema + ?Sized>() -> Result<usize, SchemaMaxSerializedSizeError>
Expand description

Returns the largest possible size of a serialised object based solely on its type T.

this is a shortcut for using BorshSchemaContainer::max_serialized_size

ยงExample

use borsh::schema::BorshSchemaContainer;

assert_eq!(Ok(8), borsh::max_serialized_size::<usize>());