I've constructed an array of arrays like this:
let mut my_array = [[false; WIDTH]; HEIGHT];
where WIDTH and HEIGHT are previously defined constants.
I want to pass the whole array to a function, and change the values within the array, although not the size/length of the array.
I've tried:
array_func(&my_array); // (in main function)
fn array_func(arr: &mut [[bool]]) {
println!("{:?}", arr);
}
And I get the error:
the trait 'std::marker::Sized' is not implemented for '[bool]'
note: `[bool]` does not have a constant size known at compile-time
note: slice and array elements must have `Sized` type
The size of my array should be known at compile time - I can't change the size of an array. At least, I thought the let mut my_array meant I could change the values within the array but not the size of the array.