Function safe_transmute::guarded_transmute_bool_pedantic
[−]
[src]
pub fn guarded_transmute_bool_pedantic(bytes: &[u8]) -> Result<&[bool], Error>
View a byte slice as a slice of boolean values.
The byte slice must have at least enough bytes to fill a single bool
.
Examples
assert_eq!(guarded_transmute_bool_pedantic(&[0x01, 0x01, 0x01, 0x01]).unwrap(), &[true, true, true, true]); assert!(guarded_transmute_bool_pedantic(&[]).is_err());