/// Resizes the bit vector to the given number of elements,
/// filling if necessary.
///
/// # Panics
///
/// Panics if `new_len` is too large. In particular the number of
/// blocks required by the capacity (`new_len / Block::nbits()`)
/// must fit in a `usize`.
Resizes the bit vector to the given number of elements,
filling if necessary.
Resizes the bit vector to the given number of elements filling if necessary .
pub fn resize(&mut self, new_len: u64, value: bool) {
        let new_block_len = Block::checked_ceil_div_nbits(new_len)
                                .expect("BitVector::resize: overflow");
        if new_len < self.bit_len() || !value {
            self.block_resize(new_block_len, Block::zero());
        } else {
            let trailing = Block::last_block_bits(self.bit_len());
            let remaining = Block::nbits() - trailing;
            for _ in 0 .. remaining {
                self.0.push_bit(true);
            }
            self.block_resize(new_block_len, !Block::zero());
        }
        self.0.truncate(1, new_len);
    }
pub fn resize ( & mut self , new_len : u64 , value : bool ) { let new_block_len = Block :: checked_ceil_div_nbits ( new_len ) . expect ( " " ) ; if new_len < self . bit_len ( ) || ! value { self . block_resize ( new_block_len , Block :: zero ( ) ) ; } else { let trailing = Block :: last_block_bits ( self . bit_len ( ) ) ; let remaining = Block :: nbits ( ) - trailing ; for _ in 0 .. remaining { self . 0 . push_bit ( true ) ; } self . block_resize ( new_block_len , ! Block :: zero ( ) ) ; } self . 0 . truncate ( 1 , new_len ) ; }
Resizes the bit vector to the given number of elements,
filling if necessary.
Resizes the bit vector to the given number of elements filling if necessary .
&mut self
new_len
u64
value
bool
panics
Panics if `new_len` is too large. In particular the number of
blocks required by the capacity (`new_len / Block::nbits()`)
must fit in a `usize`.
Panics if ` new_len ` is too large . In particular the number of blocks required by the capacity ( ` new_len / Block :: nbits () ` ) must fit in a ` usize ` .