Why multiple string types?!
Hi everyone, I've been learning Rust for the last couple of years and it's mostly been a great experience - by far the best programming language I've used.
But I have to wonder - why on earth does Rust have multiple different data types for strings? Is there any objective reason for this?
I honestly think it would be easier to simply have one type - String - and get rid of the str type. We could then have string slices as just borrows of the String type (&String).
Is there any objective reason for having multiple string types in Rust? It seems to just lead to having to write lots of .to_owned()s, String::from()s and .as_str()s, as well as defining my function signatures as this:
fn funcname<S: Into<String>>(string_param: S)
Instead of just this:
fn funcname(string_param: String)
I thought it would be interesting to discuss the positives and negatives of having many string types in Rust, as for me I honestly don't see the positives!
Any information is appreciated,
Thanks!