Module clone_cell::clone
source · Expand description
Provides the PureClone
trait, which is a restrictive form of Clone
that does not mutate
the containing Cell
.
Conceptually, the relationship between Copy
, Clone
, and PureClone
can be thought of as
follows:
Copy: PureClone: Clone
PureClone
is unsafe
because the clone
implementation must not mutate the content of Cell
through the &self
reference it gets with interior mutability. See this Stack Overflow answer
and this Rust forum thread for details.
When this crate
is built with the "derive"
feature, the PureClone
proc macro can be used to derive PureClone
for user types.