use std::net::IpAddr; use macaddr::MacAddr; #[derive(Debug, Hash, PartialOrd, Ord, Clone)] pub struct Address { mac: MacAddr, ip: IpAddr, } impl Address { pub fn new(ip: IpAddr, mac: MacAddr) -> Self { return Self { ip, mac }; } pub fn mac(&self) -> MacAddr { self.mac } pub fn ip(&self) -> IpAddr { self.ip } } impl PartialEq for Address { fn eq(&self, other: &Self) -> bool { self.ip == other.ip } } impl Eq for Address { }