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

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

Examples

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