Skip to main content

check_lib_ver

Function check_lib_ver 

Source
pub fn check_lib_ver<const SERIALIZED_LEN: usize>(
    state: &[u8; SERIALIZED_LEN],
    not_before: Option<[u8; 3]>,
) -> Result<&[u8], SuspendableError>
Expand description

A helper for deserializing an object’s state

The state_out array must have length at least SERIALIZED_LEN - 3.

Returns the number of bytes written to state_out, or a SuspendableError::IncompatibleVersion if the version of the serialized state is earlier than the specified not_before version, or is a future MAJOR or MINOR version (but future PATCH versions are ok).

Note that for testability, this will always reject if the serialized state contains a version tag of [0,0,0].

Hands back a slice to the same array, starting after the version tag.