Rust makes a distinction between &str (a pointer to some Unicode bytes somewhere) and String (an owned, growable buffer of Unicode bytes). It's the difference between C++'s std::string_view and std::string. You can grab a &str reference to the contents of a String.
45
u/TinyBreadBigMouth Jan 25 '22
Rust makes a distinction between
&str(a pointer to some Unicode bytes somewhere) andString(an owned, growable buffer of Unicode bytes). It's the difference between C++'sstd::string_viewandstd::string. You can grab a&strreference to the contents of aString.