3 ms·
Rust's different strings are different types with different underlying memory semantics and representations. This is just some syntactic sugar for strings that
by ok123456 5y ago
Rust's different strings are different types with different underlying memory semantics and representations.
This is just some syntactic sugar for strings that contain escape codes. It's still just a 'string'.
- tialaramex 5y agoAlso, the Rust language itself only has one string type, str. std::string::String comes ultimately from Rust's alloc crate, it is special only in the limited sense that the prelude makes it available without specifically asking for it, but you could define your own prelude that introduces say MyText or CPlusPlusStyleString or whatever you wanted. Admittedly having one string type is still more than C, or indeed C++ bother with but we might notice that those languages have a pretty terrible relationship with strings and suspect that's not a coincidence.