Add enum example

This commit is contained in:
laurens 2020-05-22 14:32:58 +02:00
parent 99d13b5a2f
commit 307c5c1e39
2 changed files with 21 additions and 0 deletions

12
enum_example/src/main.rs Normal file
View file

@ -0,0 +1,12 @@
#[derive(Debug)]
enum IpAddrKind {
V4(u8, u8, u8, u8),
V6(String),
}
fn main() {
let v4 = IpAddrKind::V4(127, 0, 0, 1);
let v6 = IpAddrKind::V6(String::from("::1"));
println!("Ipv4: {:#?}, Ipv6: {:#?}", v4, v6);
}