Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Comment out PartialEq and uncomment the impl below
- #[derive(PartialEq)]
- #[derive(Debug)]
- enum Maybe<T> {
- Nothing,
- Just(T),
- }
- // impl<T, U> PartialEq<Maybe<U>> for Maybe<T>
- // where
- // T: PartialEq<U>,
- // {
- // fn eq(&self, other: &Maybe<U>) -> bool {
- // match (self, other) {
- // (Maybe::Just(a), Maybe::Just(b)) => a.eq(b),
- // (Maybe::Nothing, Maybe::Nothing) => true,
- // _ => false,
- // }
- // }
- // }
- fn main() {
- assert_eq!(Maybe::Just("a"), Maybe::Just("a".to_owned()));
- println!("Hooray!");
- }
Add Comment
Please, Sign In to add comment