String seem to be very similar types. When should I use each? I am particularly concerned with the case of copying the contents of an
&str that will soon go out of scope.
String provide ownership over a string type. Both types copy a
str from the stack to the heap (via
String's interior use of
Vec<u8>) when create from an
&str, and both provide access to methods on
&str via Deref Coercion. As far as I can tell, the only differences between
String is that String defines a bunch more methods.
Am I missing anything, and when should I use
Box<str> and when should I use