pub const fn repeat<T: Clone>(value: T) -> Repeat<T>Expand description
Initializes all elements of a slice with a single repeated value.
This is used to initialize a slice where all elements are the same value. The value is cloned for each position in the slice.
ยงExamples
Filling an array with a repeated value:
use placid::prelude::*;
let place = uninit!([i32; 3]);
let owned = place.write(init::repeat(5));
assert_eq!(*owned, [5, 5, 5]);