solana_borsh::v0_10

Function try_from_slice_unchecked

Source
pub fn try_from_slice_unchecked<T: BorshDeserialize>(
    data: &[u8],
) -> Result<T, Error>
👎Deprecated since 1.18.0: Please upgrade to Borsh 1.X and use v1::try_from_slice_unchecked instead
Expand description

Deserializes without checking that the entire slice has been consumed

Normally, try_from_slice checks the length of the final slice to ensure that the deserialization uses up all of the bytes in the slice.

Note that there is a potential issue with this function. Any buffer greater than or equal to the expected size will properly deserialize. For example, if the user passes a buffer destined for a different type, the error won’t get caught as easily.