[−][src]Function safe_transmute::safe_transmute_many_permissive
pub fn safe_transmute_many_permissive<T: PodTransmutable>(
bytes: &[u8]
) -> Result<&[T], Error>
Transmute a byte slice into a sequence of values of the given type.
Errors
An error is returned in one of the following situations:
- The data does not have a memory alignment compatible with
T
. You will have to make a copy anyway, or modify how the data was originally made.
Examples
assert_eq!(safe_transmute_many_permissive::<u16>(&[0x00]), Ok([].as_ref()));