Skip to content

Instantly share code, notes, and snippets.

@z0w0
Created July 6, 2012 05:55
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 z0w0/3058314 to your computer and use it in GitHub Desktop.
Save z0w0/3058314 to your computer and use it in GitHub Desktop.
enum key {
key_a,
key_b
}
enum event {
quit,
key(key)
}
fn handle(event: event) {
alt event {
quit { quit_game(); }
key(which) {
alt which {
key_a { io::println("a was pressed!");
key_b { io::println("b was pressed!");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment