How should a function take a list of strings? `&[&str]` or `&[String]`?

124 points timand 85 comments

Taking &[&str] means it's possible to take borrowed strings, but converting from a Vec<String> means allocating a Vec to collect the references.

Is there some other way like impl Iterator<Item = impl AsRef<str>> or something?