Skip to main content

decode_from_slice_static_with_context

Function decode_from_slice_static_with_context 

Source
pub fn decode_from_slice_static_with_context<Context, D, const CAP: usize, C>(
    src: &[u8; CAP],
    config: C,
    context: Context,
) -> Result<D, DecodeError>
where D: Decode<Context> + StaticSize, C: Config, C::Mode: InternalFingerprintGuard<D, C>,
Available on crate feature static-size only.
Expand description

Attempt to decode a given type D from the given slice with a compile-time bound check and a decoding context.

This function ensures that the target type D cannot exceed the provided buffer capacity CAP at compile-time.

ยงErrors

Returns a DecodeError if the slice contains invalid data.