Moved Strings in Rust
1. fn main() {
2. let s1: String = String::from("Rust");
3. let s2: String = s1;
4. }
- The heap data from
s1is reused fors2. - When
s1goes out of scope, nothing happens (it has been moved from).
Before move to s2:

After move to s2:

