pub fn deserialize<T>(data: &[u8]) -> Result<T, DeserializationError>
where
    T: Serialize + DeserializeOwned,
{
    let value = bincode::DefaultOptions::new()
        .with_fixint_encoding()
        .allow_trailing_bytes()
        .deserialize(data)?;
    if bincode::serialized_size(&value)? != data.len() as u64 {
        return Err(DeserializationError::BytesLeftOver);
    }
    Ok(value)
}
/// Deserialize a `Deserialize` type with no limit on the size of the serialized data.
Deserialize a `Deserialize` type with no limit on the size of the serialized data.
Deserialize a ` Deserialize ` type with no limit on the size of the serialized data .
pub fn deserialize<T>(data: &[u8]) -> Result<T, DeserializationError>
where
    T: Serialize + DeserializeOwned,
{
    let value = bincode::DefaultOptions::new()
        .with_fixint_encoding()
        .allow_trailing_bytes()
        .deserialize(data)?;
    if bincode::serialized_size(&value)? != data.len() as u64 {
        return Err(DeserializationError::BytesLeftOver);
    }
    Ok(value)
}
pub fn deserialize < T > ( data : & [ u8 ] ) -> Result < T , DeserializationError > where T : Serialize + DeserializeOwned , { let value = bincode :: DefaultOptions :: new ( ) . with_fixint_encoding ( ) . allow_trailing_bytes ( ) . deserialize ( data ) ? ; if bincode :: serialized_size ( & value ) ? != data . len ( ) as u64 { return Err ( DeserializationError :: BytesLeftOver ) ; } Ok ( value ) }
Deserialize a `Deserialize` type with no limit on the size of the serialized data.
Deserialize a ` Deserialize ` type with no limit on the size of the serialized data .
data
&[u8]
data
&[u8]