https://github.com/rust-lang/rust/blob/afaf33dcafe9c7068b63eb997df221aa08db7c29/library/core/src/array/mod.rs#L563-L628
This is not a public function, so the code needs to be copied.
This is very likely be better than the existing code.
The function uses too many unstable features to be useful right now.
These issues track adding such a function to the standard library.
rust-lang/rust#69985
rust-lang/rust#81615
core::array::try_from_fn: Currently blocked on try trait v2. See tracking issue rust-lang/rust#89379
https://github.com/rust-lang/rust/blob/afaf33dcafe9c7068b63eb997df221aa08db7c29/library/core/src/array/mod.rs#L563-L628
This is not a public function, so the code needs to be copied.
This is very likely be better than the existing code.
The function uses too many unstable features to be useful right now.
These issues track adding such a function to the standard library.
rust-lang/rust#69985
rust-lang/rust#81615
core::array::try_from_fn: Currently blocked on try trait v2. See tracking issue rust-lang/rust#89379