📝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.

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. Rust, on the other hand, does not allow move semantics for types that implement Drop.

Backlinks