How to rewrite what follows so that everything is on the same line, in the function signature:
fn process(tup: &mut (u32,u32,&mut image::Luma<u8>)) {
let &mut (x,y, _) = tup;
let ref mut pixel = *tup.2;
Reached:
fn process(&mut (x,y, ref mut pixel): &mut (u32,u32,&mut image::Luma<u8>)) {
but this is not the exact equivalent, because I can no longer do:
*pixel = image::Luma([i as u8]);
inside a function that I could do when I had a time reference tup.
Failure:
src\main.rs:43:14: 43:36 note: expected type `&mut image::Luma<u8>`
src\main.rs:43:14: 43:36 note: found type `image::Luma<u8>`
I also tried:
process(&mut (x, y, pixel): &mut (u32,u32,&mut image::Luma<u8>))
but this fails:
src\main.rs:23:12: 23:29 error: cannot move out of borrowed content [E0507]
src\main.rs:23 fn process(&mut (x,y, pixel): &mut (u32,u32,&mut image::Luma<u8>)) {
^~~~~~~~~~~~~~~~~
src\main.rs:23 fn process(&mut (x,y, pixel): &mut (u32,u32,&mut image::Luma<u8>)) {
^~~~~
Basically, I need a template that can break the link to borrowed money from borrowing.