Function brownstone::build_indexed [−][src]
Expand description
Build a fixed-size array with an initializer function. The initializer is called once for each item in the length of the array, and the completed array is returned.
Each time the method is called, it is provided with the index of the element being produced.
Example
let array: [usize; 5] = brownstone::build_indexed(|i| i + 1);
assert_eq!(array, [1, 2, 3, 4, 5]);