trpl-zh-cn/listings/ch06-enums-and-pattern-matching/no-listing-02-enum-with-data/src/main.rs

13 lines
230 B
Rust

fn main() {
// ANCHOR: here
enum IpAddr {
V4(String),
V6(String),
}
let home = IpAddr::V4(String::from("127.0.0.1"));
let loopback = IpAddr::V6(String::from("::1"));
// ANCHOR_END: here
}