-
LearnRust❤️Need help understanding move & ownership errors코딩Coding/한글Rust강의★내가★공부하려고만듬 2023. 4. 14. 11:57728x90
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)r/learnrust on Reddit: Need help understanding move & ownership errors
Posted by u/DontFearTheCode - 3 votes and 2 comments
www.reddit.com
반응형'코딩Coding > 한글Rust강의★내가★공부하려고만듬' 카테고리의 다른 글
Rust Exercise -When will you turn 100? (0) 2023.04.21 Generic Traits, Impls, and Slices in Rustlang (0) 2023.04.17 Sound Synthesis러스트로 노래 나오는 사운드 웨이브 만들기 (0) 2023.04.15 러스트 코드 해볼 예정 main안에서도 struct가 되나??enum하고 (0) 2023.04.14 Building microservices with WebAssembly, Rust, and Spin - Radu Matei - Rust Linz May 2022 (0) 2023.04.07 한글Rust_Rust FullStack_Web Assembly_WASM_yew_ver0.20tutorial #yew (0) 2023.04.02 Memory safety in C++, Zig, & Rust (part 1) (0) 2023.03.28 Serverless WebAssembly for Browser Developers (0) 2023.03.24