Skip to main content

decode_from_slice_static

Function decode_from_slice_static 

Source
pub fn decode_from_slice_static<D, const CAP: usize, C>(
    src: &[u8; CAP],
    config: C,
) -> Result<D, DecodeError>
where D: Decode<()> + 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.

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.