Last active: 2 years ago
#[derive(Debug)]
enum IpAddKind {
V4,
V6,
}
#[derive(Debug)]
struct IpAddr {
kind: IpAddKind,
address: String,
}
impl IpAddr {
fn new(kind: IpAddKind, address: String) -> Self {
Self { kind, address }
}
}
fn main() {
let eno1 = IpAddr::new(IpAddKind::V4, String::from("192.168.0.250"));
let loopback = IpAddr::new(IpAddKind::V4, String::from("127.0.0.1"));
}
#[derive(Debug)]
enum IpAddKind {
V4(u8, u8, u8, u8),
V6(String),
}
fn main() {
let eno1 = IpAddKind::V4(192, 168, 0, 250);
let loopback = IpAddKind::V6(String::from("::1"));
}
enum Message {
Quite,
Move { x: i32, y: i32 },
Write(String),
ChangeColor(i32, i32, i32),
}
impl Message {
fn call(&self) {}
}
fn main() {
let m = Message::Write(String::from("xfy"));
m.call();
}