4 ms·
Nope, not ownership either, Box<str> and String both own their memory, the different is fixed size vs growable :) But you're right, I edited my post to reflect
by sirwhinesalot 4y ago
Nope, not ownership either, Box<str> and String both own their memory, the different is fixed size vs growable :)
But you're right, I edited my post to reflect this, the Java analogy is pretty strained as it is.
- Macha 4y agoI believe the parent poster was comparing &str and String, not Box<str> and String.
- sirwhinesalot 4y agoYeah in my original post (before the edit) I made a similar simplification with immutable vs mutable (since that's how they are commonly used), but the correct distinction is str vs String. You can have &str and &String and you can have &mut str and &mut String, and Box<str> and String. All cases exist.