Function safe_transmute::bool::transmute_bool_permissive

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

View a byte slice as a slice of boolean values.

The resulting slice will have as many instances of bool as will fit, can be empty.

§Examples

assert_eq!(transmute_bool_permissive(&[0x00, 0x01, 0x00, 0x01])?,
           &[false, true, false, true]);
assert_eq!(transmute_bool_permissive(&[])?, &[]);