Function collections::bitv::from_fnExperimental [-]  [+] [src]

pub fn from_fn(len: uint, f: |index: uint| -> bool) -> Bitv

Creates a Bitv of the specified length where the value at each index is f(index).

Example

extern crate collections; fn main() { use std::collections::bitv::from_fn; let bv = from_fn(5, |i| { i % 2 == 0 }); assert!(bv.eq_vec(&[true, false, true, false, true])); }
use std::collections::bitv::from_fn;

let bv = from_fn(5, |i| { i % 2 == 0 });
assert!(bv.eq_vec(&[true, false, true, false, true]));