Guest User

Untitled

a guest
Dec 14th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment