Given the code below:
let x = 5;
let y = x;
println!("{}", x);
As far as I have been reading, I learned that the above code would end up in error as the value of x has been moved to y. But it doesn't work that way. I have tried the above code with integers and strings, it just works.
"hello"is a&'static strit not allocated in the "heap" but directly "somewhere" depend on your OS etc. Anyway, reference implement copy so yes this work with reference.&str!=String== View != Object doc.rust-lang.org/book/ch08-02-strings.html#what-is-a-string