pub fn resize(&mut self, new_len: usize, value: bool) {
		let len = self.len();
		if new_len > len {
			self.reserve(new_len - len);
			unsafe {
				self.set_len(new_len);
				self.get_unchecked_mut(len .. new_len).fill(value);
			}
		}
		else {
			self.truncate(new_len);
		}
	}
/// Resizes the bit-vector to a new length. New bits are initialized to
/// `value`.
///
/// ## Original
///
/// [`Vec::resize`](alloc::vec::Vec::resize)
///
/// ## Examples
///
/// ```rust
/// use bitvec::prelude::*;
///
/// let mut bv = bitvec![0; 2];
/// bv.resize(5, true);
/// assert_eq!(bv, bits![0, 0, 1, 1, 1]);
/// ```
Resizes the bit-vector to a new length. New bits are initialized to
`value`.
Resizes the bit - vector to a new length . New bits are initialized to ` value ` .
pub fn resize(&mut self, new_len: usize, value: bool) {
		let len = self.len();
		if new_len > len {
			self.reserve(new_len - len);
			unsafe {
				self.set_len(new_len);
				self.get_unchecked_mut(len .. new_len).fill(value);
			}
		}
		else {
			self.truncate(new_len);
		}
	}
pub fn resize ( & mut self , new_len : usize , value : bool ) { let len = self . len ( ) ; if new_len > len { self . reserve ( new_len - len ) ; unsafe { self . set_len ( new_len ) ; self . get_unchecked_mut ( len .. new_len ) . fill ( value ) ; } } else { self . truncate ( new_len ) ; } }
Resizes the bit-vector to a new length.
Resizes the bit - vector to a new length .
&mut self
new_len
usize
value
bool
&mut self
new_len
usize
value
bool
original
None
examples
```rust
use bitvec::prelude::*.


` ` ` rust use bitvec :: prelude :: * .