Skip to main content

decode

Function decode 

Source
pub fn decode<'a, T: Deserialize<'a>>(
    bytes: &'a [u8],
) -> Result<T, &'static str>
Expand description

Decode an envelope from the boundary.

Borrowing is available where a type allows it (&'a str, &'a [u8]): postcard hands out slices into bytes without copying. Today’s envelopes are owned, because the copy they avoid has not been measured and API churn for an unmeasured microsecond is the wrong trade.