Function collections::bitv::from_bytesExperimental
[-]
[+]
[src]
pub fn from_bytes(bytes: &[u8]) -> Bitv
Transforms a byte-vector into a Bitv. Each byte becomes eight bits,
with the most significant bits of each byte coming first. Each
bit becomes true if equal to 1 or false if equal to 0.
Example
extern crate collections; fn main() { use std::collections::bitv; let bv = bitv::from_bytes(&[0b10100000, 0b00010010]); assert!(bv.eq_vec(&[true, false, true, false, false, false, false, false, false, false, false, true, false, false, true, false])); }use std::collections::bitv; let bv = bitv::from_bytes(&[0b10100000, 0b00010010]); assert!(bv.eq_vec(&[true, false, true, false, false, false, false, false, false, false, false, true, false, false, true, false]));