Copy is actually more than just cheap, it is trivial, i.e. it must not contain any non-
Copy types, which is what allows certain access patterns to be sound¹ and zero-cost in a generic context, when doing the same with only a
Clone type would not. The prime example is
In particular the method
get, which is only implemented for
Copy types, which allows you to take a look at the interior value without borrowing, simply by copying it. The other notable (and still unstable) method on Cell is
update. Its goal is to update the interior value, which would usually require a mutable borrow, but
Cell cannot soundly hand out mutable borrows (or any kind of borrow). Therefore it limits the implementation of
Copy types and works by
getting the interior value, moving it into the closure and having the closure return a value of the same type, which the interior
set to, afterwards.
This exploitation of
Copy types is what allows
Cell to be zero-cost and avoid the additional bookkeeping, that's used for
RefCell, which does hand out borrows, but has to track the count at runtime, which results in space and time overhead at runtime.
¹ a safe API is sound, if for any given input in a sound context, it doesn't behave undefined. Undefined behavior is the violation of guarantees the user of a programming language made to the compiler to allow certain types of optimizations, that would otherwise not be possible, e.g. removing runtime bounds checks on every element access when iterating over a vector.
Cell does have alternative
get methods for non-
Copy types, too (
replace) but they're not guaranteed to be zero-cost.