3 ms·
My first thought when I was learning Rust was "Why don't they use a different operator for move?", something like: let a <= String::from("Hi"); let b <= a; l
by someone_19 1y ago
My first thought when I was learning Rust was "Why don't they use a different operator for move?", something like:
let a <= String::from("Hi");
let b <= a;
let j = 0; // Copy
let k = j;
This may not be convenient, but it could be useful for educational purposes.
- steveklabnik 1y agoA long time ago, you would use the move keyword for this. The issue is that it’s just redundant, so it feels like unnecessary boilerplate.
- someone_19 1y ago...and using it in function calls would also be inconvenient. Now I have a clear understanding of what is happening and how. Nevertheless, using something like this for educational purposes maybe could help. Author of the article In the example with Id literally complains that moving makes moving.