Hi there !
I'm new to Rust, and there is something that I'm not able to think about yet.
This value :
"abc" has the type
&str. When I do
String::new("abc"), I convert
How I've understood, that means that &str it's a full array of unicode char, so it doesn't have fixed size (the
Sized trait in Rust if I've well understood), and
String it's a pointer to heap allocated
&str : so fixed size.
Now, when I do
s is a
String value, I get a
&str. Why ?
I see String as box with str inself. And when we take reference, we pick the value out from the box ? It means senseless for me, so there must be something I misunderstood.