Function forest_filecoin::utils::encoding::from_slice_with_fallback

source ยท
pub fn from_slice_with_fallback<'a, T: Deserialize<'a>>(
    bytes: &'a [u8],
) -> Result<T>
Expand description

This method will attempt to de-serialize given bytes using the regular serde_ipld_dagcbor::from_slice. Due to a historical issue in Lotus (see more in FIP-0027, we must still support strings with invalid UTF-8 bytes. On a failure, it will retry the operation using the fallback that will de-serialize strings with invalid UTF-8 bytes as bytes.