I want to initialize a fixed-size 2D array using a function - something like:
let init = |x, y| { /* do something and return value */ };
let a = [[init; 10]; 10];
init
could be a regular function, too.
I found this article:
https://www.joshmcguigan.com/blog/array-initialization-rust/
which lists some good options for 1D arrays, but there doesn't seem to be a 2D equivalent. Does anyone know of one?