Function limlog::try_decode
source · pub fn try_decode<T: DeserializeOwned>(
data: &[u8]
) -> Result<Option<(T, u64)>, Error>Expand description
Try to decode from stream of bytes with bincode. Notice that this takes
&[u8] instead of &mut &[u8], so cursor won’t be updated. Instead, bytes
read will be returned along with the deserialized value.
Retrun
- If the buffer starts with a valid
T, returnSome((T, bytes_read)). - If the buffer does not start with a valid
T, returnNone. This means either the buffer is not filled or it’s corrupted - If any error happened, return
Err.