pub fn init_array_from_fn<I, const N: usize, T, E>(
    make_init: impl FnMut(usize) -> I
) -> impl Init<[T; N], E>where
    I: Init<T, E>,
Expand description

Initializes an array by initializing each element via the provided initializer.

Examples

use kernel::{error::Error, init::init_array_from_fn};
let array: Box<[usize; 1_000]>= Box::init::<Error>(init_array_from_fn(|i| i)).unwrap();
assert_eq!(array.len(), 1_000);
This documentation is an old archive. Please see https://rust.docs.kernel.org instead.