2 ms·
> since it's more difficult to reason about strings as they're heap allocated I don't think them being heap allocated is the issue. I think the issue you're ru
by wtetzner 6y ago
> since it's more difficult to reason about strings as they're heap allocated
I don't think them being heap allocated is the issue. I think the issue you're running into is that String doesn't implement the Copy trait, meaning they're not automatically copied for you. Which is what you want, because you don't want to be implicitly copying large strings without realizing it. But yes, it does mean you have to learn the borrow checker.
- steveklabnik 6y agoTwo sides of the same coin: it being heap allocated is why it does not implement Copy.
- wtetzner 6y agoI guess my point was you'd have the same issue with things that are not heap allocated, if they also did not implement Copy.