mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 05:09:19 +00:00
move_semantics2
This commit is contained in:
parent
f1722f119d
commit
ef4ee0407f
@ -1,12 +1,11 @@
|
||||
// move_semantics1.rs
|
||||
// Make me compile! Execute `rustlings hint move_semantics1` for hints :)
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
fn main() {
|
||||
let vec0 = Vec::new();
|
||||
|
||||
let vec1 = fill_vec(vec0);
|
||||
let mut vec1 = fill_vec(vec0);
|
||||
|
||||
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
|
||||
|
||||
|
||||
@ -7,6 +7,9 @@
|
||||
fn main() {
|
||||
let vec0 = Vec::new();
|
||||
|
||||
// solution 1
|
||||
// let mut vec0_copy = &vec0;
|
||||
// let mut vec1 = fill_vec(vec0_copy.to_vec());
|
||||
let mut vec1 = fill_vec(vec0);
|
||||
|
||||
// Do not change the following line!
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user