Actually, that's not quite it - Copy
requires that the value can be copied using a simple memcpy
of the bytes on the stack. But copying a String
not only needs to copy the value on the stack (which is just capacity, length and a pointer to the contents) but also to create a new allocation that duplicates the contents.
This is also why Rc
, while cheap, cannot be Copy
: it needs to increment the reference counter.