if (outside == false) {
rett = vec!(
/* (100 as f64) as u8,
(255.0f64 * d as f64 / 28.0f64 as f64) as u8,
(200.0 as f64 * vec3_dot.abs()) as u8,*/
image[(u*1024.0) as usize][(v*1024.0) as usize][0]
image[(u*1024.0) as usize][(v*1024.0) as usize][1],
image[(u*1024.0) as usize][(v*1024.0) as usize][2]
);
image is of type &Vec<Vec<[u8;3]>>
image[(u*1024.0) as usize] and [(v*1024.0) as usize]
both can cause index out of bounds errors.
When there is a error I want it to print u and v.
What should be the code to handle this type of error because using get() and match would be too long ? My first guess would be something like try and expect blocks of java.
What is the proper way to handle this in rust?
edit:I just decided to check if it fits in bounds before entering u and v in the vectors with a if loop. It's only a personal project so it is fine.