I'm having tons of issues with lifetime and borrowing right now.
There are 3 big problems:
- The body of the snake (?)
fn get_adjacent_vertices(&mut self, _set : Set)is moving the Struct, "Set", around which gives me this compiler messagemove occurs because _set has type Set<'_>, which does not implement the Copy trait
I've tried to implement Copy using both #[derive(Copy)] and impl Copy for Set {} , but they both spit out errors complaining that "Set cannot have this trait".
If I borrow it claims that the arguments of the function are incorrect.
-
&_set.set[neighbor_x][neighbor_y]claims that "Borrowed value _set.set does not live enough". I have zero ideas on how to fix this issue (I've never used lifetimes on my own) -
{if !(neighbor.is_solid()) {self.adjacent.push(neighbor)}}has the compiler claiming that thelifetime may not live long enough argument requires that 1 must outlive 2. It also says thatmain.rs(41, 41): has type Set<1> /ln main.rs(41, 30): has type &mut Vertex<2>. again, I don't have any idea how to solve this