summaryrefslogtreecommitdiffstats
path: root/examples/06_enum-nonexhaustive.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/06_enum-nonexhaustive.rs')
-rw-r--r--examples/06_enum-nonexhaustive.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/06_enum-nonexhaustive.rs b/examples/06_enum-nonexhaustive.rs
new file mode 100644
index 0000000..14d5bc8
--- /dev/null
+++ b/examples/06_enum-nonexhaustive.rs
@@ -0,0 +1,11 @@
+enum Color {
+ Red,
+ Green,
+ Blue,
+}
+
+fn main () {
+ let c = Red;
+ println!("{}", match c { Red => "r", Green => "g" });
+}
+