1 //! Imports from `std` that would be polyfilled for `no_std` builds (see
2 //! `src/polyfill/no_std`).
3 //!
4 //! This implementation is used when `std` is available and just imports the
5 //! necessary items from `std`. For `no_std` builds, the file
6 //! `src/polyfill/no_std` is used instead, which doesn't depend on the standard
7 //! library.
8 
9 #[cfg(not(windows))]
10 pub mod io {
11     pub use std::io::{IoSlice, IoSliceMut};
12 }
13 
14 #[cfg(not(any(target_os = "redox", target_os = "wasi")))]
15 #[cfg(feature = "net")]
16 pub mod net {
17     pub use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
18 }
19 
20 pub mod os {
21     pub mod fd {
22         // Change  to use `std::os::fd` when MSRV becomes 1.66 or higher.
23 
24         #[cfg(unix)]
25         pub use std::os::unix::io::{
26             AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd,
27         };
28         #[cfg(target_os = "wasi")]
29         pub use std::os::wasi::io::{
30             AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd,
31         };
32     }
33 
34     #[cfg(windows)]
35     pub mod windows {
36         pub mod io {
37             pub use std::os::windows::io::{
38                 AsRawSocket, AsSocket, BorrowedSocket, FromRawSocket, IntoRawSocket, OwnedSocket,
39                 RawSocket,
40             };
41         }
42     }
43 }
44