pub trait PlatformDeserializableFromVersionedStructure {
// Required method
fn versioned_deserialize(
data: &[u8],
platform_version: &PlatformVersion,
) -> Result<Self, ProtocolError>
where Self: Sized;
}Required Methods§
Sourcefn versioned_deserialize(
data: &[u8],
platform_version: &PlatformVersion,
) -> Result<Self, ProtocolError>where
Self: Sized,
fn versioned_deserialize(
data: &[u8],
platform_version: &PlatformVersion,
) -> Result<Self, ProtocolError>where
Self: Sized,
We will deserialize a versioned structure into a code structure For example we have DataContractV0 and DataContractV1 The system version will tell which version to deserialize into This happens by first deserializing the data into a potentially versioned structure For example we could have DataContractSerializationFormatV0 and DataContractSerializationFormatV1 Both of the structures will be valid in perpetuity as they are saved into the state. So from the bytes we could get DataContractSerializationFormatV0. Then the system_version given will tell to transform DataContractSerializationFormatV0 into DataContractV1 (if system version is 1)