I am using the numpy crate in Rust to work with 2D arrays that come from python. PyArray
(https://docs.rs/numpy/0.11.0/numpy/array/struct.PyArray.html) implements a from_vec2()
function, which converts a Vec<Vec<T>>
into a PyArray<T, 2>
(2D PyArray), and a to_vec()
function, which flattens the 2D array into a 1D vector and returns Vec<T>
, but it does not implement to_vec2()
. Is there a simple way to do this conversion which I am missing, or would I have to implement this function by hand?
Thanks.