Moving values semantics.

This commit is contained in:
neerajadsul 2023-08-19 15:08:05 +01:00
parent b0cfea824f
commit ed5be7f1d6
2 changed files with 4 additions and 6 deletions

View File

@ -3,12 +3,11 @@
// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand
// for a hint.
// I AM NOT DONE
fn main() {
let vec0 = Vec::new();
let mut vec0 = Vec::new();
let vec1 = fill_vec(vec0);
let mut vec1 = fill_vec(vec0);
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);

View File

@ -7,12 +7,11 @@
// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand
// for a hint.
// I AM NOT DONE
fn main() {
let vec0 = Vec::new();
let vec0 = fill_vec(Vec::new());
let mut vec1 = fill_vec(vec0);
let mut vec1 = vec0.clone();
println!("{} has length {}, with contents: `{:?}`", "vec0", vec0.len(), vec0);