fn ip_addr_enum() {
    #[derive(Debug)]
    enum IpAddr {
        V4(String),
        V6(String),
    }

    let home = IpAddr::V4(String::from("127.0.0.1"));
    println!("In ip_addr_enum, home is  {:?}.", home);

    let loopback = IpAddr::V6(String::from("::1"));
    println!("In ip_addr_enum, loopback is  {:?}.", loopback);
}
// We attach data to each variant of the enum directly, so there is no need for 
// an extra struct.
We attach data to each variant of the enum directly, so there is no need for
an extra struct.
We attach data to each variant of the enum directly so there is no need for an extra struct .
fn ip_addr_enum() {
    #[derive(Debug)]
    enum IpAddr {
        V4(String),
        V6(String),
    }
    let home = IpAddr::V4(String::from("127.0.0.1"));
    println!("In ip_addr_enum, home is  {:?}.", home);
    let loopback = IpAddr::V6(String::from("::1"));
    println!("In ip_addr_enum, loopback is  {:?}.", loopback);
}
fn ip_addr_enum ( ) { # [ derive ( Debug ) ] enum IpAddr { V4 ( String ) , V6 ( String ) , } let home = IpAddr :: V4 ( String :: from ( " " ) ) ; println ! ( " " home ) ; let loopback = IpAddr :: V6 ( String :: from ( " " ) ) ; println ! ( " " loopback ) ; }
We attach data to each variant of the enum directly, so there is no need for
an extra struct.
We attach data to each variant of the enum directly so there is no need for an extra struct .