solana_sdk::deserialize_utils

Function default_on_eof

source
pub fn default_on_eof<'de, T, D>(d: D) -> Result<T, D::Error>
where D: Deserializer<'de>, T: Deserialize<'de> + Default,
Expand description

This helper function enables successful deserialization of versioned structs; new structs may include additional fields if they impl Default and are added to the end of the struct. Right now, this function is targeted at bincode deserialization; the error match may need to be updated if another package needs to be used in the future.