Function safe_transmute::bool::bytes_are_bool[][src]

pub fn bytes_are_bool(v: &[u8]) -> bool

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]));