Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- trait Fun{
- fn fun(&self, y : i32);
- }
- impl Fun for Option<(i32,i32)> {
- fn fun(&self, y : i32) {
- if let Some((param1,param2)) = self {
- println!("{} {} {}",param1,param2,y);
- }
- }
- }
- fn main(){
- let a = Some((1,2));
- let b = None;
- a.fun(5);
- b.fun(6);
- }
Add Comment
Please, Sign In to add comment