|
|
|
|
|
by alpaca128
2000 days ago
|
|
What I tend to stumble over is how String and &str each have some
methods and features that the other lacks, e.g. concatenation.
Which of course makes sense with basic understanding of string
slices, but sometimes I can't shake the weird feeling that I'm
cloning some String unnecessarily. And I just wish generic type parameters wouldn't have to be
propagated through all types touching them. That said I'm really happy with how it develops and Rust comes
with many little details that I sorely miss in other languages.
Thanks for all the effort. |
|
If you're familiar with say, `Vec<u8>` and `[u8]`, `String` and `str` are basically the same except they are contractually valid UTF bytes. So just like you can `push` and `extend` to a `Vec`, you can do the same to a `String`.
With regard to generic type parameters, if you want to code in Java or Go style, you can use dynamic dispatch trait objects to remove type parameters.