I have this array
let buffer: &[u8] = &[0; 40000];
But when I want to map it like this:
*buffer.map( |x| 0xff);
I have the following error:
error[E0599]: no method named `map` found for type `&[u8]` in the current scope
--> src/bin/save_png.rs:12:13
|
12 | *buffer.map( |x| 0xff); //.map(|x| 0xff);
| ^^^
|
= note: the method `map` exists but the following trait bounds were not satisfied:
`&mut &[u8] : std::iter::Iterator`
`&mut [u8] : std::iter::Iterator`
I tried several ways to do the elements mutable but I can't get the right syntax. Anyone have experience? I'm trying to work with a png image buffer.