pub fn fill_with<F>(&mut self, mut func: F)
	where F: FnMut(usize) -> bool {
		for (idx, ptr) in self.as_mut_bitptr_range().enumerate() {
			unsafe {
				ptr.write(func(idx));
			}
		}
	}
/// Fills the bit-slice with bits produced by a generator function.
///
/// ## Original
///
/// [`slice::fill_with`](https://doc.rust-lang.org/std/primitive.slice.html#method.fill_with)
///
/// ## API Differences
///
/// The generator function receives the index of the bit being initialized
/// as an argument.
///
/// ## Examples
///
/// ```rust
/// use bitvec::prelude::*;
///
/// let bits = bits![mut 0; 5];
/// bits.fill_with(|idx| idx % 2 == 0);
/// assert_eq!(bits, bits![1, 0, 1, 0, 1]);
/// ```
Fills the bit-slice with bits produced by a generator function.
Fills the bit - slice with bits produced by a generator function .
pub fn fill_with<F>(&mut self, mut func: F)
	where F: FnMut(usize) -> bool {
		for (idx, ptr) in self.as_mut_bitptr_range().enumerate() {
			unsafe {
				ptr.write(func(idx));
			}
		}
	}
pub fn fill_with < F > ( & mut self , mut func : F ) where F : FnMut ( usize ) -> bool { for ( idx , ptr ) in self . as_mut_bitptr_range ( ) . enumerate ( ) { unsafe { ptr . write ( func ( idx ) ) ; } } }
Fills the bit-slice with bits produced by a generator function.
Fills the bit - slice with bits produced by a generator function .
&mut self
func
F
&mut self
func
F
original
None
api differences
The generator function receives the index of the bit being initialized
as an argument.
The generator function receives the index of the bit being initialized as an argument .
examples
```rust
use bitvec::prelude::*.


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