Function safe_transmute::guarded_transmute_bool_vec_pedantic
[−]
[src]
pub fn guarded_transmute_bool_vec_pedantic(
bytes: Vec<u8>
) -> Result<Vec<bool>, Error>
Trasform a byte vector into a vector of bool.
The vector's allocated byte buffer will be reused when possible, and should not have extraneous data.
Examples
assert_eq!(guarded_transmute_bool_vec_pedantic(vec![0x00, 0x01, 0x00, 0x01])?, vec![false, true, false, true]); assert!(guarded_transmute_bool_vec_pedantic(vec![]).is_err()); assert!(guarded_transmute_bool_vec_pedantic(vec![0x04, 0x00, 0xED]).is_err());