I use an external library function, that get as input the type:
&mut [&mut [f32]]
, which should represent a 2-d array with fixed dimensions.
For better performance, I would like to create a 1-dimension array, so all the data will sit continuously in memory, and transform it to the above form.
However, I am little struggling due to lack of experience in Rust, and I wonder what is the “Rust way” to achieve my goal.
One way I could think of, is creating a new Vec
, iterating the 1-dimensional arra, and push every slice to it, but it feels like a waste of memory.
Thanks in advance.