I understand the ins-and-outs of C++ semantics and how it translates to machine code, but I still have some doubts about how it works in Rust. If I pass a reference in Rust, obviously it translates to an address being passed to the function.
However, if I pass an object that will move ownership to the function called, is this also an address? This is how the std::move would do it in C++ and it would make sense. Are any objects (or structs in Rust) ever passed in their entirety on the stack in Rust? There should be no need to, I think.
I'm actually not positive and thus am hesitant to reply, but I think the semantics in Rust match std::move. I'll see if I can verify that and update you, though, don't make any life-critical decisions or anything based on that...
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I understand the ins-and-outs of C++ semantics and how it translates to machine code, but I still have some doubts about how it works in Rust. If I pass a reference in Rust, obviously it translates to an address being passed to the function.
However, if I pass an object that will move ownership to the function called, is this also an address? This is how the
std::move
would do it in C++ and it would make sense. Are any objects (or structs in Rust) ever passed in their entirety on the stack in Rust? There should be no need to, I think.I'm actually not positive and thus am hesitant to reply, but I think the semantics in Rust match
std::move
. I'll see if I can verify that and update you, though, don't make any life-critical decisions or anything based on that...