LearnRust❤️Need help understanding move & ownership errors
Need help understanding move & ownership errors
If there is a better place to get help please let me know
So, I'm hoping I could get some detailed help with a few errors then from there I could fix errors on my own because I get it. [Most of the code is here.](https://github.com/formula1/card-game/tree/master/card-lang-rust)
- [My first problem is here.](https://github.com/formula1/card-game/blob/master/card-lang-rust/src/types/Lexer.rs#L45)
- I tried to fix ownership by returning `Self` in each function that uses `self`. This way it would use then pass back.
- I was told to use &self but I still have two errors
- https://github.com/formula1/card-game/blob/and-self/card-lang-rust/src/types/Lexer.rs
- `borrowed value does not live long enough`
- `cannot borrow \`*self\` as mutable because it is also borrowed as immutable
mutable borrow occurs here`
- [here](https://github.com/formula1/card-game/blob/and-self/card-lang-rust/src/calculator/lexer/tokens/digit.rs) I'm getting `\`l\` is a \`&\` reference, so the data it refers to cannot be borrowed as mutable`
- [Here I'm trying to mutate in loops but rust doesn't like that](https://github.com/formula1/card-game/blob/and-self/card-lang-rust/src/types/Parser.rs#L43)
- [Here I cannot move because it's behind a shared reference](https://github.com/formula1/card-game/blob/and-self/card-lang-rust/src/types/Evaluator.rs#L122)