Skip to content

Instantly share code, notes, and snippets.

@thiagopnts
Created December 18, 2014 20:35
Show Gist options
  • Save thiagopnts/c2ff1a6f05feed731c74 to your computer and use it in GitHub Desktop.
Save thiagopnts/c2ff1a6f05feed731c74 to your computer and use it in GitHub Desktop.
enum OptionalInt {
Value(int),
Missing,
}
fn main() {
let x = Value(5);
let y = Missing;
match x {
Value(n) => println!("x is {}", n),
Missing => println!("x is missing!"),
}
match y {
Value(n) => println!("y is {}", n),
Missing => println!("y is missing!"),
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment