3 ms·
tine, tiny note: it means Clone on write, not Copy, and it's String not Str.
by steveklabnik 9y ago
tine, tiny note: it means Clone on write, not Copy, and it's String not Str.
- eridius 9y agoOops, typo. I've updated my comment accordingly, thanks. Also, I didn't realize it was Clone-on-write. Interesting, and the documentation does confirm this. I say "interesting" because the actual operation involved is `to_owned()`, not `clone()`, seeing as how `clone()` on a `&str` just gives you the same `&str` back.
- steveklabnik 9y agoYeah, conceptually it's closer to Clone even if it's not literally Clone.