'What happens when you clone a `&str`?
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?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
