std/sys/net/connection/
unsupported.rs

1use crate::fmt;
2use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut};
3use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
4use crate::sys::unsupported;
5use crate::time::Duration;
6
7pub struct TcpStream(!);
8
9impl TcpStream {
10    pub fn connect(_: io::Result<&SocketAddr>) -> io::Result<TcpStream> {
11        unsupported()
12    }
13
14    pub fn connect_timeout(_: &SocketAddr, _: Duration) -> io::Result<TcpStream> {
15        unsupported()
16    }
17
18    pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
19        self.0
20    }
21
22    pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
23        self.0
24    }
25
26    pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
27        self.0
28    }
29
30    pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
31        self.0
32    }
33
34    pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
35        self.0
36    }
37
38    pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
39        self.0
40    }
41
42    pub fn read_buf(&self, _buf: BorrowedCursor<'_>) -> io::Result<()> {
43        self.0
44    }
45
46    pub fn read_vectored(&self, _: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
47        self.0
48    }
49
50    pub fn is_read_vectored(&self) -> bool {
51        self.0
52    }
53
54    pub fn write(&self, _: &[u8]) -> io::Result<usize> {
55        self.0
56    }
57
58    pub fn write_vectored(&self, _: &[IoSlice<'_>]) -> io::Result<usize> {
59        self.0
60    }
61
62    pub fn is_write_vectored(&self) -> bool {
63        self.0
64    }
65
66    pub fn peer_addr(&self) -> io::Result<SocketAddr> {
67        self.0
68    }
69
70    pub fn socket_addr(&self) -> io::Result<SocketAddr> {
71        self.0
72    }
73
74    pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
75        self.0
76    }
77
78    pub fn duplicate(&self) -> io::Result<TcpStream> {
79        self.0
80    }
81
82    pub fn set_linger(&self, _: Option<Duration>) -> io::Result<()> {
83        self.0
84    }
85
86    pub fn linger(&self) -> io::Result<Option<Duration>> {
87        self.0
88    }
89
90    pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
91        self.0
92    }
93
94    pub fn nodelay(&self) -> io::Result<bool> {
95        self.0
96    }
97
98    pub fn set_ttl(&self, _: u32) -> io::Result<()> {
99        self.0
100    }
101
102    pub fn ttl(&self) -> io::Result<u32> {
103        self.0
104    }
105
106    pub fn take_error(&self) -> io::Result<Option<io::Error>> {
107        self.0
108    }
109
110    pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
111        self.0
112    }
113}
114
115impl fmt::Debug for TcpStream {
116    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
117        self.0
118    }
119}
120
121pub struct TcpListener(!);
122
123impl TcpListener {
124    pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<TcpListener> {
125        unsupported()
126    }
127
128    pub fn socket_addr(&self) -> io::Result<SocketAddr> {
129        self.0
130    }
131
132    pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
133        self.0
134    }
135
136    pub fn duplicate(&self) -> io::Result<TcpListener> {
137        self.0
138    }
139
140    pub fn set_ttl(&self, _: u32) -> io::Result<()> {
141        self.0
142    }
143
144    pub fn ttl(&self) -> io::Result<u32> {
145        self.0
146    }
147
148    pub fn set_only_v6(&self, _: bool) -> io::Result<()> {
149        self.0
150    }
151
152    pub fn only_v6(&self) -> io::Result<bool> {
153        self.0
154    }
155
156    pub fn take_error(&self) -> io::Result<Option<io::Error>> {
157        self.0
158    }
159
160    pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
161        self.0
162    }
163}
164
165impl fmt::Debug for TcpListener {
166    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
167        self.0
168    }
169}
170
171pub struct UdpSocket(!);
172
173impl UdpSocket {
174    pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<UdpSocket> {
175        unsupported()
176    }
177
178    pub fn peer_addr(&self) -> io::Result<SocketAddr> {
179        self.0
180    }
181
182    pub fn socket_addr(&self) -> io::Result<SocketAddr> {
183        self.0
184    }
185
186    pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
187        self.0
188    }
189
190    pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
191        self.0
192    }
193
194    pub fn send_to(&self, _: &[u8], _: &SocketAddr) -> io::Result<usize> {
195        self.0
196    }
197
198    pub fn duplicate(&self) -> io::Result<UdpSocket> {
199        self.0
200    }
201
202    pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
203        self.0
204    }
205
206    pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
207        self.0
208    }
209
210    pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
211        self.0
212    }
213
214    pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
215        self.0
216    }
217
218    pub fn set_broadcast(&self, _: bool) -> io::Result<()> {
219        self.0
220    }
221
222    pub fn broadcast(&self) -> io::Result<bool> {
223        self.0
224    }
225
226    pub fn set_multicast_loop_v4(&self, _: bool) -> io::Result<()> {
227        self.0
228    }
229
230    pub fn multicast_loop_v4(&self) -> io::Result<bool> {
231        self.0
232    }
233
234    pub fn set_multicast_ttl_v4(&self, _: u32) -> io::Result<()> {
235        self.0
236    }
237
238    pub fn multicast_ttl_v4(&self) -> io::Result<u32> {
239        self.0
240    }
241
242    pub fn set_multicast_loop_v6(&self, _: bool) -> io::Result<()> {
243        self.0
244    }
245
246    pub fn multicast_loop_v6(&self) -> io::Result<bool> {
247        self.0
248    }
249
250    pub fn join_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
251        self.0
252    }
253
254    pub fn join_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
255        self.0
256    }
257
258    pub fn leave_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
259        self.0
260    }
261
262    pub fn leave_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
263        self.0
264    }
265
266    pub fn set_ttl(&self, _: u32) -> io::Result<()> {
267        self.0
268    }
269
270    pub fn ttl(&self) -> io::Result<u32> {
271        self.0
272    }
273
274    pub fn take_error(&self) -> io::Result<Option<io::Error>> {
275        self.0
276    }
277
278    pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
279        self.0
280    }
281
282    pub fn recv(&self, _: &mut [u8]) -> io::Result<usize> {
283        self.0
284    }
285
286    pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
287        self.0
288    }
289
290    pub fn send(&self, _: &[u8]) -> io::Result<usize> {
291        self.0
292    }
293
294    pub fn connect(&self, _: io::Result<&SocketAddr>) -> io::Result<()> {
295        self.0
296    }
297}
298
299impl fmt::Debug for UdpSocket {
300    fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result {
301        self.0
302    }
303}
304
305pub struct LookupHost(!);
306
307impl LookupHost {
308    pub fn port(&self) -> u16 {
309        self.0
310    }
311}
312
313impl Iterator for LookupHost {
314    type Item = SocketAddr;
315    fn next(&mut self) -> Option<SocketAddr> {
316        self.0
317    }
318}
319
320impl TryFrom<&str> for LookupHost {
321    type Error = io::Error;
322
323    fn try_from(_v: &str) -> io::Result<LookupHost> {
324        unsupported()
325    }
326}
327
328impl<'a> TryFrom<(&'a str, u16)> for LookupHost {
329    type Error = io::Error;
330
331    fn try_from(_v: (&'a str, u16)) -> io::Result<LookupHost> {
332        unsupported()
333    }
334}