daily pastebin goal
51%
SHARE
TWEET

Untitled

a guest Dec 14th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Comment out PartialEq and uncomment the impl below
  2.  
  3. #[derive(PartialEq)]
  4. #[derive(Debug)]
  5. enum Maybe<T> {
  6.     Nothing,
  7.     Just(T),
  8. }
  9.  
  10. // impl<T, U> PartialEq<Maybe<U>> for Maybe<T>
  11. // where
  12. //     T: PartialEq<U>,
  13. // {
  14. //     fn eq(&self, other: &Maybe<U>) -> bool {
  15. //         match (self, other) {
  16. //             (Maybe::Just(a), Maybe::Just(b)) => a.eq(b),
  17. //             (Maybe::Nothing, Maybe::Nothing) => true,
  18. //             _ => false,
  19. //         }
  20. //     }
  21. // }
  22.  
  23. fn main() {
  24.     assert_eq!(Maybe::Just("a"), Maybe::Just("a".to_owned()));
  25.    
  26.     println!("Hooray!");
  27. }
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