matchmaker/src/server/util.rs
2025-03-17 18:52:48 -07:00

33 lines
No EOL
509 B
Rust

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 {
}