Created
August 1, 2014 21:03
-
-
Save dwrensha/4d9fa08c1176ddf64352 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Foo { | |
x : Vec<int>, y : Vec<int> | |
} | |
fn main () { | |
let foo = box Foo { x : vec![1,2,3], y : vec![4,5,6]}; | |
let box Foo { x, y } = foo; | |
} |
What do I do if I want to move foo.x one place and foo.y somewhere else?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
test.rs:8:22: 8:23 error: use of partially moved value:
foo.y
test.rs:8 let box Foo { x, y } = foo;
^
test.rs:8:19: 8:20 note:
foo.x
moved here because it has typecollections::vec::Vec<int>
, which is moved by default (useref
to override)test.rs:8 let box Foo { x, y } = foo;