mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-09 20:29:18 +00:00
Moving values semantics.
This commit is contained in:
parent
b0cfea824f
commit
ed5be7f1d6
@ -3,12 +3,11 @@
|
|||||||
// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics1` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
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);
|
println!("{} has length {} content `{:?}`", "vec1", vec1.len(), vec1);
|
||||||
|
|
||||||
|
|||||||
@ -7,12 +7,11 @@
|
|||||||
// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand
|
// Execute `rustlings hint move_semantics2` or use the `hint` watch subcommand
|
||||||
// for a hint.
|
// for a hint.
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
fn main() {
|
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);
|
println!("{} has length {}, with contents: `{:?}`", "vec0", vec0.len(), vec0);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user