zebra_chain::serialization::arbitrary

Function max_allocation_is_big_enough

source
pub fn max_allocation_is_big_enough<T>(item: T) -> (usize, usize, usize, usize)
Expand description

Allocate a maximum-sized vector of cloned items, and serialize that array.

Returns the following calculations on item: smallest_disallowed_vec_len smallest_disallowed_serialized_len largest_allowed_vec_len largest_allowed_serialized_len

For varible-size types, largest_allowed_serialized_len might not fit within MAX_PROTOCOL_MESSAGE_LEN or MAX_BLOCK_SIZE.