Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- let a = Data{ value: 1 };
- println!("This is a {:?}", a);
- one(a);
- println!("This is a {:?}", a);
- two(a);
- println!("This is a {:?}", a);
- }
- #[derive(Debug)]
- struct Data {
- value : i32
- }
- fn one(num: Data) -> () {
- let side_effect = num.value + 1;
- println!("this is the side effect {}", side_effect);
- }
- fn two(num: Data) -> () {
- let side_effect = num.value + 1;
- println!("this is the side effect {}", side_effect);
- }
Add Comment
Please, Sign In to add comment