Function spl_pod::bytemuck::pod_maybe_from_bytes
source · pub fn pod_maybe_from_bytes<T: Pod>(
bytes: &[u8]
) -> Result<Option<&T>, ProgramError>
Expand description
Maybe convert a slice of bytes into a Pod
(zero copy)
Returns None
if the slice is empty, or else Err
if input length is not equal to
pod_get_packed_len::<T>()
.
This function exists primarily because Option<T>
is not a Pod
.