Guest User

Untitled

a guest
Jan 18th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. fn main() {
  2. let a = Data{ value: 1 };
  3. println!("This is a {:?}", a);
  4. one(a);
  5. println!("This is a {:?}", a);
  6. two(a);
  7. println!("This is a {:?}", a);
  8.  
  9. }
  10.  
  11. #[derive(Debug)]
  12. struct Data {
  13. value : i32
  14. }
  15.  
  16. fn one(num: Data) -> () {
  17. let side_effect = num.value + 1;
  18. println!("this is the side effect {}", side_effect);
  19. }
  20.  
  21. fn two(num: Data) -> () {
  22. let side_effect = num.value + 1;
  23. println!("this is the side effect {}", side_effect);
  24. }
Add Comment
Please, Sign In to add comment