Skip to content

Instantly share code, notes, and snippets.

@kenpratt
Last active August 29, 2015 14:03
Show Gist options
  • Save kenpratt/5a8b5b1e59dca8eae118 to your computer and use it in GitHub Desktop.
Save kenpratt/5a8b5b1e59dca8eae118 to your computer and use it in GitHub Desktop.
enum Test {
One(String),
Two(String),
Three(uint),
Four(bool)
}
fn check(s: Test) {
match s {
Some("x") => println!("got an x"),
Some("y") => println!("got a y"),
_ => println!("nope")
}
}
fn main() {
check(One("x".to_str()));
check(One("y".to_str()));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment