4 ms·
Rule of thumb: use &str when you don't need more than that, use String when creating text at runtime, returning from a function or storing it in a struct field.
by estebank 4y ago
Rule of thumb: use &str when you don't need more than that, use String when creating text at runtime, returning from a function or storing it in a struct field.
Using borrowed values in general in fields is best avoided until you get more comfortable with the rest of the language.