File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ pub async fn connect_async<M: Message + Sync + Send>(
9797}
9898
9999/// Returns the socket address for the given address.
100+ #[ cfg( any( feature = "tcp" , feature = "udp" ) ) ]
100101pub ( crate ) fn get_socket_addr < T : std:: net:: ToSocketAddrs > (
101102 address : T ,
102103) -> Result < std:: net:: SocketAddr , io:: Error > {
@@ -126,8 +127,11 @@ impl AsyncConnectable for ConnectionAddress {
126127 M : Message + Sync + Send ,
127128 {
128129 match self {
130+ #[ cfg( feature = "tcp" ) ]
129131 Self :: Tcp ( connectable) => connectable. connect_async :: < M > ( ) . await ,
132+ #[ cfg( feature = "udp" ) ]
130133 Self :: Udp ( connectable) => connectable. connect_async :: < M > ( ) . await ,
134+ #[ cfg( feature = "direct-serial" ) ]
131135 Self :: Serial ( connectable) => connectable. connect_async :: < M > ( ) . await ,
132136 Self :: File ( connectable) => connectable. connect_async :: < M > ( ) . await ,
133137 }
Original file line number Diff line number Diff line change @@ -87,17 +87,23 @@ impl Display for FileConnectable {
8787 }
8888}
8989pub enum ConnectionAddress {
90+ #[ cfg( feature = "tcp" ) ]
9091 Tcp ( TcpConnectable ) ,
92+ #[ cfg( feature = "udp" ) ]
9193 Udp ( UdpConnectable ) ,
94+ #[ cfg( feature = "direct-serial" ) ]
9295 Serial ( SerialConnectable ) ,
9396 File ( FileConnectable ) ,
9497}
9598
9699impl Display for ConnectionAddress {
97100 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
98101 match self {
102+ #[ cfg( feature = "tcp" ) ]
99103 Self :: Tcp ( connectable) => write ! ( f, "{connectable}" ) ,
104+ #[ cfg( feature = "udp" ) ]
100105 Self :: Udp ( connectable) => write ! ( f, "{connectable}" ) ,
106+ #[ cfg( feature = "direct-serial" ) ]
101107 Self :: Serial ( connectable) => write ! ( f, "{connectable}" ) ,
102108 Self :: File ( connectable) => write ! ( f, "{connectable}" ) ,
103109 }
Original file line number Diff line number Diff line change @@ -87,6 +87,7 @@ pub fn connect<M: Message + Sync + Send>(
8787}
8888
8989/// Returns the socket address for the given address.
90+ #[ cfg( any( feature = "tcp" , feature = "udp" ) ) ]
9091pub ( crate ) fn get_socket_addr < T : std:: net:: ToSocketAddrs > (
9192 address : & T ,
9293) -> Result < std:: net:: SocketAddr , io:: Error > {
@@ -106,8 +107,11 @@ impl Connectable for ConnectionAddress {
106107 M : Message ,
107108 {
108109 match self {
110+ #[ cfg( feature = "tcp" ) ]
109111 Self :: Tcp ( connectable) => connectable. connect :: < M > ( ) ,
112+ #[ cfg( feature = "udp" ) ]
110113 Self :: Udp ( connectable) => connectable. connect :: < M > ( ) ,
114+ #[ cfg( feature = "direct-serial" ) ]
111115 Self :: Serial ( connectable) => connectable. connect :: < M > ( ) ,
112116 Self :: File ( connectable) => connectable. connect :: < M > ( ) ,
113117 }
You can’t perform that action at this time.
0 commit comments