daily pastebin goal
19%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top