When to use &str instead of String::new and vice versa ?
Thank you.
When to use &str instead of String::new and vice versa ?
Thank you.
Have you read chapter 4 of the book? It goes into this question in detail https://doc.rust-lang.org/book/second-edition/ch04-00-understanding-ownership.html