]> git.lizzy.rs Git - rust.git/blob - library/std/src/sys/unix/l4re.rs
Rollup merge of #84320 - jsha:details-implementors, r=Manishearth,Nemo157,GuillaumeGomez
[rust.git] / library / std / src / sys / unix / l4re.rs
1 macro_rules! unimpl {
2     () => {
3         return Err(io::Error::new_const(
4             io::ErrorKind::Unsupported,
5             &"No networking available on L4Re.",
6         ));
7     };
8 }
9
10 pub mod net {
11     #![allow(warnings)]
12     use crate::convert::TryFrom;
13     use crate::fmt;
14     use crate::io::{self, IoSlice, IoSliceMut};
15     use crate::net::{Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr};
16     use crate::sys::fd::FileDesc;
17     use crate::sys_common::{AsInner, FromInner, IntoInner};
18     use crate::time::Duration;
19
20     #[allow(unused_extern_crates)]
21     pub extern crate libc as netc;
22
23     pub struct Socket(FileDesc);
24     impl Socket {
25         pub fn new(_: &SocketAddr, _: libc::c_int) -> io::Result<Socket> {
26             unimpl!();
27         }
28
29         pub fn new_raw(_: libc::c_int, _: libc::c_int) -> io::Result<Socket> {
30             unimpl!();
31         }
32
33         pub fn new_pair(_: libc::c_int, _: libc::c_int) -> io::Result<(Socket, Socket)> {
34             unimpl!();
35         }
36
37         pub fn connect_timeout(&self, _: &SocketAddr, _: Duration) -> io::Result<()> {
38             unimpl!();
39         }
40
41         pub fn accept(
42             &self,
43             _: *mut libc::sockaddr,
44             _: *mut libc::socklen_t,
45         ) -> io::Result<Socket> {
46             unimpl!();
47         }
48
49         pub fn duplicate(&self) -> io::Result<Socket> {
50             unimpl!();
51         }
52
53         pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
54             unimpl!();
55         }
56
57         pub fn read_vectored(&self, _: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
58             unimpl!();
59         }
60
61         pub fn is_read_vectored(&self) -> bool {
62             unimpl!();
63         }
64
65         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
66             unimpl!();
67         }
68
69         pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
70             unimpl!();
71         }
72
73         pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
74             unimpl!();
75         }
76
77         pub fn write(&self, _: &[u8]) -> io::Result<usize> {
78             unimpl!();
79         }
80
81         pub fn write_vectored(&self, _: &[IoSlice<'_>]) -> io::Result<usize> {
82             unimpl!();
83         }
84
85         pub fn is_write_vectored(&self) -> bool {
86             unimpl!();
87         }
88
89         pub fn set_timeout(&self, _: Option<Duration>, _: libc::c_int) -> io::Result<()> {
90             unimpl!();
91         }
92
93         pub fn timeout(&self, _: libc::c_int) -> io::Result<Option<Duration>> {
94             unimpl!();
95         }
96
97         pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
98             unimpl!();
99         }
100
101         pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
102             unimpl!();
103         }
104
105         pub fn nodelay(&self) -> io::Result<bool> {
106             unimpl!();
107         }
108
109         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
110             unimpl!();
111         }
112
113         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
114             unimpl!();
115         }
116     }
117
118     impl AsInner<libc::c_int> for Socket {
119         fn as_inner(&self) -> &libc::c_int {
120             self.0.as_inner()
121         }
122     }
123
124     impl FromInner<libc::c_int> for Socket {
125         fn from_inner(fd: libc::c_int) -> Socket {
126             Socket(FileDesc::new(fd))
127         }
128     }
129
130     impl IntoInner<libc::c_int> for Socket {
131         fn into_inner(self) -> libc::c_int {
132             self.0.into_raw()
133         }
134     }
135
136     pub struct TcpStream {
137         inner: Socket,
138     }
139
140     impl TcpStream {
141         pub fn connect(_: io::Result<&SocketAddr>) -> io::Result<TcpStream> {
142             unimpl!();
143         }
144
145         pub fn connect_timeout(_: &SocketAddr, _: Duration) -> io::Result<TcpStream> {
146             unimpl!();
147         }
148
149         pub fn socket(&self) -> &Socket {
150             &self.inner
151         }
152
153         pub fn into_socket(self) -> Socket {
154             self.inner
155         }
156
157         pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
158             unimpl!();
159         }
160
161         pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
162             unimpl!();
163         }
164
165         pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
166             unimpl!();
167         }
168
169         pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
170             unimpl!();
171         }
172
173         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
174             unimpl!();
175         }
176
177         pub fn read(&self, _: &mut [u8]) -> io::Result<usize> {
178             unimpl!();
179         }
180
181         pub fn read_vectored(&self, _: &mut [IoSliceMut<'_>]) -> io::Result<usize> {
182             unimpl!();
183         }
184
185         pub fn is_read_vectored(&self) -> bool {
186             unimpl!();
187         }
188
189         pub fn write(&self, _: &[u8]) -> io::Result<usize> {
190             unimpl!();
191         }
192
193         pub fn write_vectored(&self, _: &[IoSlice<'_>]) -> io::Result<usize> {
194             unimpl!();
195         }
196
197         pub fn is_write_vectored(&self) -> bool {
198             unimpl!();
199         }
200
201         pub fn peer_addr(&self) -> io::Result<SocketAddr> {
202             unimpl!();
203         }
204
205         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
206             unimpl!();
207         }
208
209         pub fn shutdown(&self, _: Shutdown) -> io::Result<()> {
210             unimpl!();
211         }
212
213         pub fn duplicate(&self) -> io::Result<TcpStream> {
214             unimpl!();
215         }
216
217         pub fn set_nodelay(&self, _: bool) -> io::Result<()> {
218             unimpl!();
219         }
220
221         pub fn nodelay(&self) -> io::Result<bool> {
222             unimpl!();
223         }
224
225         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
226             unimpl!();
227         }
228
229         pub fn ttl(&self) -> io::Result<u32> {
230             unimpl!();
231         }
232
233         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
234             unimpl!();
235         }
236
237         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
238             unimpl!();
239         }
240     }
241
242     impl FromInner<Socket> for TcpStream {
243         fn from_inner(socket: Socket) -> TcpStream {
244             TcpStream { inner: socket }
245         }
246     }
247
248     impl fmt::Debug for TcpStream {
249         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
250             write!(f, "No networking support available on L4Re")
251         }
252     }
253
254     pub struct TcpListener {
255         inner: Socket,
256     }
257
258     impl TcpListener {
259         pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<TcpListener> {
260             unimpl!();
261         }
262
263         pub fn socket(&self) -> &Socket {
264             &self.inner
265         }
266
267         pub fn into_socket(self) -> Socket {
268             self.inner
269         }
270
271         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
272             unimpl!();
273         }
274
275         pub fn accept(&self) -> io::Result<(TcpStream, SocketAddr)> {
276             unimpl!();
277         }
278
279         pub fn duplicate(&self) -> io::Result<TcpListener> {
280             unimpl!();
281         }
282
283         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
284             unimpl!();
285         }
286
287         pub fn ttl(&self) -> io::Result<u32> {
288             unimpl!();
289         }
290
291         pub fn set_only_v6(&self, _: bool) -> io::Result<()> {
292             unimpl!();
293         }
294
295         pub fn only_v6(&self) -> io::Result<bool> {
296             unimpl!();
297         }
298
299         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
300             unimpl!();
301         }
302
303         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
304             unimpl!();
305         }
306     }
307
308     impl FromInner<Socket> for TcpListener {
309         fn from_inner(socket: Socket) -> TcpListener {
310             TcpListener { inner: socket }
311         }
312     }
313
314     impl fmt::Debug for TcpListener {
315         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
316             write!(f, "No networking support available on L4Re.")
317         }
318     }
319
320     pub struct UdpSocket {
321         inner: Socket,
322     }
323
324     impl UdpSocket {
325         pub fn bind(_: io::Result<&SocketAddr>) -> io::Result<UdpSocket> {
326             unimpl!();
327         }
328
329         pub fn socket(&self) -> &Socket {
330             &self.inner
331         }
332
333         pub fn into_socket(self) -> Socket {
334             self.inner
335         }
336
337         pub fn peer_addr(&self) -> io::Result<SocketAddr> {
338             unimpl!();
339         }
340
341         pub fn socket_addr(&self) -> io::Result<SocketAddr> {
342             unimpl!();
343         }
344
345         pub fn recv_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
346             unimpl!();
347         }
348
349         pub fn peek_from(&self, _: &mut [u8]) -> io::Result<(usize, SocketAddr)> {
350             unimpl!();
351         }
352
353         pub fn send_to(&self, _: &[u8], _: &SocketAddr) -> io::Result<usize> {
354             unimpl!();
355         }
356
357         pub fn duplicate(&self) -> io::Result<UdpSocket> {
358             unimpl!();
359         }
360
361         pub fn set_read_timeout(&self, _: Option<Duration>) -> io::Result<()> {
362             unimpl!();
363         }
364
365         pub fn set_write_timeout(&self, _: Option<Duration>) -> io::Result<()> {
366             unimpl!();
367         }
368
369         pub fn read_timeout(&self) -> io::Result<Option<Duration>> {
370             unimpl!();
371         }
372
373         pub fn write_timeout(&self) -> io::Result<Option<Duration>> {
374             unimpl!();
375         }
376
377         pub fn set_broadcast(&self, _: bool) -> io::Result<()> {
378             unimpl!();
379         }
380
381         pub fn broadcast(&self) -> io::Result<bool> {
382             unimpl!();
383         }
384
385         pub fn set_multicast_loop_v4(&self, _: bool) -> io::Result<()> {
386             unimpl!();
387         }
388
389         pub fn multicast_loop_v4(&self) -> io::Result<bool> {
390             unimpl!();
391         }
392
393         pub fn set_multicast_ttl_v4(&self, _: u32) -> io::Result<()> {
394             unimpl!();
395         }
396
397         pub fn multicast_ttl_v4(&self) -> io::Result<u32> {
398             unimpl!();
399         }
400
401         pub fn set_multicast_loop_v6(&self, _: bool) -> io::Result<()> {
402             unimpl!();
403         }
404
405         pub fn multicast_loop_v6(&self) -> io::Result<bool> {
406             unimpl!();
407         }
408
409         pub fn join_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
410             unimpl!();
411         }
412
413         pub fn join_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
414             unimpl!();
415         }
416
417         pub fn leave_multicast_v4(&self, _: &Ipv4Addr, _: &Ipv4Addr) -> io::Result<()> {
418             unimpl!();
419         }
420
421         pub fn leave_multicast_v6(&self, _: &Ipv6Addr, _: u32) -> io::Result<()> {
422             unimpl!();
423         }
424
425         pub fn set_ttl(&self, _: u32) -> io::Result<()> {
426             unimpl!();
427         }
428
429         pub fn ttl(&self) -> io::Result<u32> {
430             unimpl!();
431         }
432
433         pub fn take_error(&self) -> io::Result<Option<io::Error>> {
434             unimpl!();
435         }
436
437         pub fn set_nonblocking(&self, _: bool) -> io::Result<()> {
438             unimpl!();
439         }
440
441         pub fn recv(&self, _: &mut [u8]) -> io::Result<usize> {
442             unimpl!();
443         }
444
445         pub fn peek(&self, _: &mut [u8]) -> io::Result<usize> {
446             unimpl!();
447         }
448
449         pub fn send(&self, _: &[u8]) -> io::Result<usize> {
450             unimpl!();
451         }
452
453         pub fn connect(&self, _: io::Result<&SocketAddr>) -> io::Result<()> {
454             unimpl!();
455         }
456     }
457
458     impl FromInner<Socket> for UdpSocket {
459         fn from_inner(socket: Socket) -> UdpSocket {
460             UdpSocket { inner: socket }
461         }
462     }
463
464     impl fmt::Debug for UdpSocket {
465         fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
466             write!(f, "No networking support on L4Re available.")
467         }
468     }
469
470     pub struct LookupHost {
471         original: *mut libc::addrinfo,
472         cur: *mut libc::addrinfo,
473     }
474
475     impl Iterator for LookupHost {
476         type Item = SocketAddr;
477         fn next(&mut self) -> Option<SocketAddr> {
478             None
479         }
480     }
481
482     impl LookupHost {
483         pub fn port(&self) -> u16 {
484             unimpl!();
485         }
486     }
487
488     unsafe impl Sync for LookupHost {}
489     unsafe impl Send for LookupHost {}
490
491     impl TryFrom<&str> for LookupHost {
492         type Error = io::Error;
493
494         fn try_from(_v: &str) -> io::Result<LookupHost> {
495             unimpl!();
496         }
497     }
498
499     impl<'a> TryFrom<(&'a str, u16)> for LookupHost {
500         type Error = io::Error;
501
502         fn try_from(_v: (&'a str, u16)) -> io::Result<LookupHost> {
503             unimpl!();
504         }
505     }
506 }