Re:My favorite Rust function
by masklinn on Sunday October 13, 2019 @03:48AM
(#21239069)
Rust doesn't have copy constructors per-se (it really doesn't have ctors in he C++ sense). Copy is a "marker trait", its operation can not be overridden and is always (semantically) a simple memcpy. The truth is that Copy is not a thing at runtime, it's only a compile-time restriction (when not present).
Clone would be what comes closest to copy constructors, and it has to be explicitly invoked.
Clone would be what comes closest to copy constructors, and it has to be explicitly invoked.