How to create two-dimensional vector or/and array

let mut all_elements: Vec::<Vec::<f32>> = vec![vec![0.0,steps],steps]; //dim steps*steps 
//where steps-const defining size of array,which type u32

My attempt like this,but: expected f32, found u32
help: you can cast an u32 to f32, producing the floating point representation of the integer, rounded if necessary: steps as f32rustc(E0308), 61): expected f32, found u32`

Vector of the given size is defined with vec![item; size], not vec![item, size] - note the semicolon.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.