Function safe_transmute::bool::bytes_are_bool

source ·
pub fn bytes_are_bool(v: &[u8]) -> bool
Expand description

Makes sure that the bytes represent a sequence of valid boolean values.

§Examples

assert!(bytes_are_bool(&[false as u8, true as u8]));

assert!(!bytes_are_bool(&[(false as u8 + true as u8) * 2]));