Skip to main content

try_ref_from_prefix_suffix

Function try_ref_from_prefix_suffix 

Source
pub(crate) fn try_ref_from_prefix_suffix<S, T>(
    source: &S,
    cast_type: CastType,
    meta: Option<T::PointerMetadata>,
) -> Result<(&T, &[u8]), TryCastError<&S, T>>
Expand description

Validates and interprets the given affix of source’s bytes as a &T.

Returns the destination reference and excess bytes on success. All errors, including validity errors, contain the original &S.