What are the differences between Rust’s `String` and `str`?
String is the dynamic heap string type, like Vec: use it when you need to own or modify your string data. str is an immutable1 sequence of UTF-8 bytes of dynamic length somewhere in memory. Since the size is unknown, one can only handle it behind a pointer. This means that str most commonly2 appears … Read more