3 ms·
In C++ terms, String is std::string, &str is std::string_view. They're different things, but they can appear similar.
by AlotOfReading 2y ago
In C++ terms, String is std::string, &str is std::string_view. They're different things, but they can appear similar.
- brabel 2y agoA Rust `String` reference (i.e. &String) can always be passed where `&str` is expected because `String` has a `Deref<Target=str>` impl... in that sense they don't just appear similar, they are polymorphic.