pub fn deserialise_with_limit<T>(data: &[u8], size_limit: Bounded) -> Result<T, SerialisationError>
where
    T: DeserializeOwned,
{
    let mut cursor = Cursor::new(data);
    let value = deserialize_from(&mut cursor, size_limit)
        .map_err(|e| SerialisationError::Deserialise(*e))?;
    if cursor.position() != data.len() as u64 {
        return Err(SerialisationError::DeserialiseExtraBytes);
    }
    Ok(value)
}
/// Deserialise a `Deserialize` type with max size limit specified.
Deserialise a `Deserialize` type with max size limit specified.
Deserialise a ` Deserialize ` type with max size limit specified .
pub fn deserialise_with_limit<T>(data: &[u8], size_limit: Bounded) -> Result<T, SerialisationError>
where
    T: DeserializeOwned,
{
    let mut cursor = Cursor::new(data);
    let value = deserialize_from(&mut cursor, size_limit)
        .map_err(|e| SerialisationError::Deserialise(*e))?;
    if cursor.position() != data.len() as u64 {
        return Err(SerialisationError::DeserialiseExtraBytes);
    }
    Ok(value)
}
pub fn deserialise_with_limit < T > ( data : & [ u8 ] , size_limit : Bounded ) -> Result < T , SerialisationError > where T : DeserializeOwned , { let mut cursor = Cursor :: new ( data ) ; let value = deserialize_from ( & mut cursor , size_limit ) . map_err ( | e | SerialisationError :: Deserialise ( * e ) ) ? ; if cursor . position ( ) != data . len ( ) as u64 { return Err ( SerialisationError :: DeserialiseExtraBytes ) ; } Ok ( value ) }
Deserialise a `Deserialize` type with max size limit specified.
Deserialise a ` Deserialize ` type with max size limit specified .
data
&[u8]
size_limit
Bounded
data
&[u8]
size_limit
Bounded