I have a struct
similar to this:
struct Foo<'a> {
callbacks: Vec<&'a FnMut(u32)>,
}
I want to call each callback, but my attempt doesn't work:
fn foo(&mut self) {
for f in &mut self.callbacks {
(*f)(0);
}
}
I get this error:
error: cannot borrow immutable borrowed content `**f` as mutable
I also tried iter_mut()
but I get the same error.