I am copying some value from one array to another with 3-D array , but It is giving Index Out of Bounds , can anyone help me with this ....
fn main() {
const IUNITS1: usize = 30;
const IUNITS2: usize = 98;
const TEMP: usize = 2;
let mut tempXS = Array::<f32, _>::zeros((TEMP, IUNITS1, IUNITS2));
let mut x: [[[f32; IUNITS1]; IUNITS2]; TEMP] = [[[0.0; IUNITS1]; IUNITS2]; TEMP];
for i in 0..TEMP as usize {
for j in 0..IUNITS1 as usize {
for k in 0..IUNITS2 as usize {
tempXS[[i, j, k]] = x[i][j][k];
println!("{:?}", tempXS[[i, j, k]]);
}
}
}
}
Error : thread 'main' panicked at 'index out of bounds: the len is 30 but the index is 30', src/main.rs:234:u5272: