Warning
This post was published 36 days ago. The information described in this article may have changed.
If I understand correctly there is no possibility for a variable within the code to own a literal string (one gets &'static str
) or to de-reference a String with *myString
(although one can get a slice.) So the ownership is only of the reference / slice, or of a String
.
(I'm aware one can also do &*myString
and other variants.)
Error returned is something about Sized trait not being implemented for strings, but it seems odd to me since in many cases it's quite clear that the size of a string is fixed.
I am a newcomer to Rust so if you could explain this not overly technical language that would be useful.
13 posts - 4 participants
🏷️ rust_feed