pub fn from_bytes(bytes: &[u8]) -> Bitv {
        let len = bytes.len().checked_mul(u8::BITS).expect("capacity overflow");
        let mut bitv = Bitv::with_capacity(len);
        let complete_words = bytes.len() / 4;
        let extra_bytes = bytes.len() % 4;

        bitv.nbits = len;

        for i in 0..complete_words {
            bitv.storage.push(
                ((reverse_bits(bytes[i * 4 + 0]) as u32) << 0) |
                ((reverse_bits(bytes[i * 4 + 1]) as u32) << 8) |
                ((reverse_bits(bytes[i * 4 + 2]) as u32) << 16) |
                ((reverse_bits(bytes[i * 4 + 3]) as u32) << 24)
            );
        }

        if extra_bytes > 0 {
            let mut last_word = 0u32;
            for (i, &byte) in bytes[complete_words*4..].iter().enumerate() {
                last_word |= (reverse_bits(byte) as u32) << (i * 8);
            }
            bitv.storage.push(last_word);
        }

        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.
///
/// # Examples
///
/// ```
/// 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]));
/// ```
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.
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 .
pub fn from_bytes(bytes: &[u8]) -> Bitv {
        let len = bytes.len().checked_mul(u8::BITS).expect("capacity overflow");
        let mut bitv = Bitv::with_capacity(len);
        let complete_words = bytes.len() / 4;
        let extra_bytes = bytes.len() % 4;
        bitv.nbits = len;
        for i in 0..complete_words {
            bitv.storage.push(
                ((reverse_bits(bytes[i * 4 + 0]) as u32) << 0) |
                ((reverse_bits(bytes[i * 4 + 1]) as u32) << 8) |
                ((reverse_bits(bytes[i * 4 + 2]) as u32) << 16) |
                ((reverse_bits(bytes[i * 4 + 3]) as u32) << 24)
            );
        }
        if extra_bytes > 0 {
            let mut last_word = 0u32;
            for (i, &byte) in bytes[complete_words*4..].iter().enumerate() {
                last_word |= (reverse_bits(byte) as u32) << (i * 8);
            }
            bitv.storage.push(last_word);
        }
        bitv
    }
pub fn from_bytes ( bytes : & [ u8 ] ) -> Bitv { let len = bytes . len ( ) . checked_mul ( u8 :: BITS ) . expect ( " " ) ; let mut bitv = Bitv :: with_capacity ( len ) ; let complete_words = bytes . len ( ) / 4 ; let extra_bytes = bytes . len ( ) % 4 ; bitv . nbits = len ; for i in 0 .. complete_words { bitv . storage . push ( ( ( reverse_bits ( bytes [ i * 4 + 0 ] ) as u32 ) << 0 ) | ( ( reverse_bits ( bytes [ i * 4 + 1 ] ) as u32 ) << 8 ) | ( ( reverse_bits ( bytes [ i * 4 + 2 ] ) as u32 ) << 16 ) | ( ( reverse_bits ( bytes [ i * 4 + 3 ] ) as u32 ) << 24 ) ) ; } if extra_bytes > 0 { let mut last_word = 0u32 ; for ( i , & byte ) in bytes [ complete_words * 4 .. ] . iter ( ) . enumerate ( ) { last_word |= ( reverse_bits ( byte ) as u32 ) << ( i * 8 ) ; } bitv . storage . push ( last_word ) ; } bitv }
Transforms a byte-vector into a `Bitv`.
Transforms a byte - vector into a ` Bitv ` .
bytes
&[u8]
bytes
&[u8]
examples
```
use std::collections::Bitv.


` ` ` use std :: collections :: Bitv .