11 ms·
That source &str can be de-allocated before the String, and you need to track that through some kind of Rc. String is not just about mutability but also about o
by unrealhoang 8y ago
That source &str can be de-allocated before the String, and you need to track that through some kind of Rc. String is not just about mutability but also about ownership, if my function got a String, I know for sure after its execution, the memory will be released (if I don’t transfer the ownership back). I like this way much more. If in any case I need Cow, well, Rust has that in the standard library.