top | item 44636612

(no title)

someone_19 | 7 months 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.

discuss

order

steveklabnik|7 months ago

A 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|7 months 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.