📝In Rust, all types are movable
Rust compiler considers all types movable and this is very common for rust programs. Any fn(self)
method relies on move, fn new() -> Self
moves result. As of , there is no way to opt out from move semantics.
In C++, move constructors need to be implemented separately and must be careful to leave the moved out object in the state valid to call delete
. In Rust, move is just a memcopy and is destructive. (Destructive/non-destructive move)