[−][src]Function maligned::align_first_boxed
#[must_use]pub fn align_first_boxed<T, A: Alignment, F: FnMut(usize) -> T>(
s_capacity: usize,
f: F
) -> Box<[T]>
Aligns types and initializes memory to the return value provided by the closure. Since boxed slices can never re-allocate the first item will always be aligned.
let f = |i|(i & u8::max_value() as usize) as u8; let s = align_first_boxed::<u8, A128, _>(1023, f); assert_eq!(s.len(), 1023); s.iter().for_each(|b| assert_eq!(*b, f(*b as usize)));