Function safe_transmute::bool::transmute_bool_pedantic

source ·
pub fn transmute_bool_pedantic(
    bytes: &[u8]
) -> Result<&[bool], Error<'_, u8, bool>>
Expand description

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!(transmute_bool_pedantic(&[0x01, 0x01, 0x01, 0x01])?,
           &[true, true, true, true]);
assert!(transmute_bool_pedantic(&[]).is_err());