1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
//! ETP套接字 use unmp::net::Id; /// socket地址 #[derive(Clone)] pub struct Addr( /// 设备ID pub Id, /// 端口号 pub u8, ); /// 监听器 pub trait Socket { fn port(&self) -> u8; fn recv_handle(&self, remote: &Addr, data: &[u8]); }