Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Notice this type DERIVES Copy?
- //that means this type will Copy, not move.
- #[derive(Copy)]
- pub struct CopyExample {
- pub data: u64,
- pub other_data: u32
- }
- fn move_example() {
- let x = CopyExample{ data: 5, other_data: 2000 };
- let y = x;
- assert_eq!(y,x); //Test Passed
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement