Better HN
topnewbestaskshowjobs
Log inSign up

throwmeawayjj

3 karma · joined Jan 3, 2019 (7y ago) · 1 submissions

Submissions

comment 7y ago · link · parent

> I still don't understand how or why a non-reference is implicitly consumed by passing it (read-only intention) by value(?) to another function and then can't be used again.

By default the value is moved in Rust, just like with std::move in C++17, which you say you know. This is to avoid performance issues when you pass complex structures, such as vectors, around. If you want to copy your value, you have to call .copy() explicitly.