Skip to content

Instantly share code, notes, and snippets.

@lkuper
Created August 25, 2013 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lkuper/6336481 to your computer and use it in GitHub Desktop.
Save lkuper/6336481 to your computer and use it in GitHub Desktop.
enum Color { cyan, magenta, yellow, black }
impl Eq for Color {
fn eq(&self, other: &Color) -> bool {
match (*self, *other) {
(cyan, cyan) => { true }
(magenta, magenta) => { true }
(yellow, yellow) => { true }
(black, black) => { true }
_ => { false }
}
}
}
fn main() {
println(fmt!("%?, %?", cyan == yellow, cyan == cyan));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment