Hello everyone! I'm working on suffix tree so I've got a problem walking along the tree.
The borrow checker says me
mutable borrow starts here in previous iteration of loop, I understand what it's talking about. This leads to the situation when a program could have two mutable references to the same piece of data but in my case there is one reference
current so the case can be considered as re-borrowing which is legal as far as I got.
The borrow checker doesn't raise any error if I replace
get_mut by getting an element by index e.g. call
index_mut. I don't see the difference between the methods from the point of the mutability. Both of them accept
&mut self. Both of them return a mutable references but
What is the difference between the methods? Is this re-borrowing or not?
P.S. I can't just proceed with getting an element by index because I need to write a wrapper for the array which doesn't work as well but I removed from the example to keep it simple.