diff --git a/master/src/master_server.rs b/master/src/master_server.rs index 034470b..d6d8ad4 100644 --- a/master/src/master_server.rs +++ b/master/src/master_server.rs @@ -9,6 +9,7 @@ use std::{ io, net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs, UdpSocket}, ops::Deref, + str::FromStr, sync::atomic::{AtomicBool, Ordering}, time::{Duration, Instant}, }; @@ -35,7 +36,7 @@ use crate::{ }; pub trait AddrExt: Sized + Eq + Hash + Display + Copy + ToSocketAddrs + ServerAddress { - type Ip; + type Ip: Eq + Hash + Display + Copy + FromStr; fn extract(addr: SocketAddr) -> Result; fn ip(&self) -> &Self::Ip; @@ -261,11 +262,7 @@ impl Master { } } -impl MasterServer -where - Addr: AddrExt, - Addr::Ip: Eq + Hash + Display + Copy + std::str::FromStr, -{ +impl MasterServer { pub fn new(cfg: Config, addr: Addr) -> Result { info!("Listen address: {}", addr); @@ -694,7 +691,6 @@ where fn helper(args: &[&str], mut op: F) where Addr: AddrExt, - Addr::Ip: std::str::FromStr, F: FnMut(&str, Addr::Ip), { let iter = args.iter().map(|i| (i, i.parse::()));