serde_cbor::de

Function from_slice_with_scratch

Source
pub fn from_slice_with_scratch<'a, 'b, T>(
    slice: &'a [u8],
    scratch: &'b mut [u8],
) -> Result<T>
where T: Deserialize<'a>,
Expand description

Decode a value from CBOR data using a scratch buffer.

Users should generally prefer to use from_slice or from_mut_slice over this function, as decoding may fail when the scratch buffer turns out to be too small.

A realistic use case for this method would be decoding in a no_std environment from an immutable slice that is too large to copy.