[go: up one dir, main page]

Function decode_from_slice

Source
pub fn decode_from_slice<D, C>(
    slice: &[u8],
    config: C,
) -> Result<(D, usize), DecodeError>
where D: DeserializeOwned, C: Config,
Available on crate feature serde only.
Expand description

Attempt to decode a given type D from the given slice. Returns the decoded output and the amount of bytes read.

Note that this does not work with borrowed types like &str or &[u8]. For that use borrow_decode_from_slice.

See the config module for more information on configurations.