I'm new to Rust and trying to write my little ECS (for educational purposes mostly). I'm stuck for almost a week with this part - to implement generic visitor for a single component (it's a start, right?) for a "system" callback of the form of fn(comp_ref){}.
Unfortunately, this mix of generics, refs and lifetimes is clearly too much for me to grasp:
Here visitor is accepting a slice to column data and should iterate over it calling provided handler for each item in slice. Problem is I'm getting compilation errors like:
62 | let vis: Visitor1<&mut i32, > = Visitor1::new(|: &mut i32| {});
| ^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected mutable reference &'a mut _
found mutable reference &mut _
and I don;t understand how fix them.
Is it possible to achieve my goal?