So, I have an error in my code and I have a hard time understanding mutability and borrowing. I'm kinda new to Rust, so excuse my ignorance.
I would like to tokenize the given text with given charset. Actually, I have created a Playground example so that you can test it live.
buffer is borrowed immutable in
for loop. That's oddly counter-intuitive for me since I have already defined it
mut above the
for loop. Why does it borrow the mutable variable as immutable?
Also, the compiler complains about borrow, not move. I thought curly braces create new scope, thus move occurs without
&buffer. What does it complain about borrow while I do not pass a reference to buffer with ampersand (aka
Thanks in advance.