Function rufl::collection::fill

source ·
pub fn fill<T: Clone>(vec: Vec<T>, initial: T) -> Vec<T>
Expand description

fills elements of vector with initial value.

§Arguments

  • vec - The vector to perform fill.

  • initial - The value to be filled.

§Returns

Returns the new filled vector.

§Examples

use rufl::collection;

let vec1 = vec![0; 5];

assert_eq!(vec![0, 0, 0, 0, 0], vec1);

assert_eq!(vec![1, 1, 1, 1, 1], collection::fill(vec1, 1));