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))]
10pub mod io {
11 pub use std::io::{IoSlice, IoSliceMut};
12}
13
14#[cfg(not(target_os = "wasi"))]
15#[cfg(feature = "net")]
16pub mod net {
17 pub use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
18}
19
20pub mod os {
21 pub mod fd {
22 // Change to use `std::os::fd` when MSRV becomes Rust 1.66 or higher.
23
24 #[cfg(target_os = "wasi")]
25 pub use std::os::fd::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd};
26 #[cfg(unix)]
27 pub use std::os::unix::io::{
28 AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, OwnedFd, RawFd,
29 };
30 }
31
32 #[cfg(windows)]
33 pub mod windows {
34 pub mod io {
35 pub use std::os::windows::io::{
36 AsRawSocket, AsSocket, BorrowedSocket, FromRawSocket, IntoRawSocket, OwnedSocket,
37 RawSocket,
38 };
39 }
40 }
41}
42