[][src]Function maligned::align_first_boxed_cloned

#[must_use]pub fn align_first_boxed_cloned<T: Clone, A: Alignment>(
    s_capacity: usize,
    initial: T
) -> Box<[T]>

Aligns types and initializes all values to clones of initial then returns a boxed slice. Since boxed slices can never re-allocate the first item will always be aligned.

let initial = 42;
let s = align_first_boxed_cloned::<u8, A128>(1023, initial);
assert_eq!(s.len(), 1023);
s.iter().for_each(|b| assert_eq!(*b, initial));