What happens when you clone a &str
?
Is the cloned &str
pointing to the same place as clonee &str
or is it something?
Is this documented anywhere?
What happens when you clone a &str
?
Is the cloned &str
pointing to the same place as clonee &str
or is it something?
Is this documented anywhere?
Cloning a &str
is the same as cloning any &T
; it just copies the reference.
Clone
is implemented for any &T
. It literally just returns itself since it is Copy
.
This is documented under reference's docs.