Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. //Notice this type DERIVES Copy?
  2. //that means this type will Copy, not move.
  3. #[derive(Copy)]
  4. pub struct CopyExample {
  5. pub data: u64,
  6. pub other_data: u32
  7. }
  8.  
  9. fn move_example() {
  10. let x = CopyExample{ data: 5, other_data: 2000 };
  11. let y = x;
  12. assert_eq!(y,x); //Test Passed
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement