my understanding is that declaring a string variable like the following
let x = "a string"
allocates memory for immutable x on the stack
while declaring x like this
let x = String::from("a string");
does the same but on the heap. And this way we create a mutable string variable.
My question is this, is there any difference between the following:
let mut x = "a string";
and
let x = String::from("a string");
doesn't this mean that in both cases x is a mutable string variable?
can I assign x to another variable as in "y = x"
?