diff options
author | Benno Lossin <benno.lossin@proton.me> | 2023-08-14 10:47:15 +0200 |
---|---|---|
committer | Miguel Ojeda <ojeda@kernel.org> | 2023-08-21 14:31:49 +0200 |
commit | 9e49439077fe0a9aa062e682193b1f3257b314e2 (patch) | |
tree | 19d5a38c93c2ff2f448435544ab39241521bfa41 /COPYING | |
parent | rust: init: add `..Zeroable::zeroed()` syntax for zeroing all missing fields (diff) | |
download | linux-9e49439077fe0a9aa062e682193b1f3257b314e2.tar.xz linux-9e49439077fe0a9aa062e682193b1f3257b314e2.zip |
rust: init: add functions to create array initializers
Add two functions `pin_init_array_from_fn` and `init_array_from_fn` that
take a function that generates initializers for `T` from `usize`, the added
functions then return an initializer for `[T; N]` where every element is
initialized by an element returned from the generator function.
Suggested-by: Asahi Lina <lina@asahilina.net>
Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20230814084602.25699-9-benno.lossin@proton.me
[ Cleaned a couple trivial nits. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'COPYING')
0 files changed, 0 insertions, 0 deletions