Guest User

Untitled

a guest
Jan 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. trait Fun{
  2. fn fun(&self, y : i32);
  3. }
  4.  
  5. impl Fun for Option<(i32,i32)> {
  6. fn fun(&self, y : i32) {
  7. if let Some((param1,param2)) = self {
  8. println!("{} {} {}",param1,param2,y);
  9. }
  10. }
  11. }
  12.  
  13.  
  14. fn main(){
  15. let a = Some((1,2));
  16. let b = None;
  17. a.fun(5);
  18. b.fun(6);
  19.  
  20. }
Add Comment
Please, Sign In to add comment