I am new to Rust. I often get stuck by borrow checker and move errors while using vectors in for-loop, while-loop, if-statement and functions.
I read necessary chapters, did some practice and used Rustlings.
I mostly run into following errors when I am using vectors in functions, for-loop, while-loop, and if-statement.
borrow of moved value: `vector1` cannot find `vector1` in the scope cannot borrow `vector1` as mutable more than once at a time cannot borrow `vector1` as mutable because it is also borrowed as immutable
Can you give a concise set of rules or advice for ownership, borrowing and move in rust? How do you avoid/tackle Rust's borrow-checker and move errors while using vectors specially in functions, for-loop, while-loop, and if-statement? Can you refer to some webpage for a good summary, tutorial or code practice?