summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-03-variants-with-different-data/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-03-variants-with-different-data/src/main.rs')
-rw-r--r--src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-03-variants-with-different-data/src/main.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-03-variants-with-different-data/src/main.rs b/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-03-variants-with-different-data/src/main.rs
new file mode 100644
index 000000000..844a14041
--- /dev/null
+++ b/src/doc/book/listings/ch06-enums-and-pattern-matching/no-listing-03-variants-with-different-data/src/main.rs
@@ -0,0 +1,12 @@
+fn main() {
+ // ANCHOR: here
+ enum IpAddr {
+ V4(u8, u8, u8, u8),
+ V6(String),
+ }
+
+ let home = IpAddr::V4(127, 0, 0, 1);
+
+ let loopback = IpAddr::V6(String::from("::1"));
+ // ANCHOR_END: here
+}