Hacker News new | ask | show | jobs
by yoklov 2773 days ago
Rust's `Clone` trait is deep by default, except for

- Types with shared semantics (e.g. Rc<T>, Arc<T>), or holding onto these internally

- Types holding borrowed references (these will still reference the same data).

C++'s copy constructors are too, but there are more caveats, although they're similar in principal to Rust's caveats.