Clone traits support the following attributes:
- Container attributes
- Field attributes
Note that while the generated implementation is good for structures, it might
not be very efficient for enumerations. What it does is check if both
and the clone-from value have the same variant, if they have, use
on the members, otherwise fallback to
*self = other.clone();. Ask yourself if
you really need this.
As most other traits,
Debug support a custom bound on container
and fields. See
Debug's documentation for more
rustc can optimize
derive(Clone, Copy) to generate faster, smaller code.
So does derivative. But rustc does not know about
would not optimize
To avoid that issue, you should avoid deriving
Clone using rustc's default
derivative. derivative will error if it detects
that, but can't always do it.