#![deny(missing_docs)]
#![cfg_attr(all(wasi_ext, target_os = "wasi"), feature(wasi_ext))]
#![cfg(any(unix, windows, target_os = "wasi"))]
mod portability;
mod traits;
#[cfg(not(io_safety_is_in_std))]
mod types;
#[cfg(not(io_safety_is_in_std))]
mod impls_std;
#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
pub use traits::AsFd;
#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
pub use traits::{AsHandle, AsSocket};
#[cfg(any(unix, target_os = "wasi"))]
#[allow(deprecated)]
pub use traits::{FromFd, IntoFd};
#[cfg(windows)]
#[allow(deprecated)]
pub use traits::{FromHandle, FromSocket, IntoHandle, IntoSocket};
#[cfg(not(io_safety_is_in_std))]
#[cfg(any(unix, target_os = "wasi"))]
pub use types::{BorrowedFd, OwnedFd};
#[cfg(not(io_safety_is_in_std))]
#[cfg(windows)]
pub use types::{
BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError, NullHandleError,
OwnedHandle, OwnedSocket,
};
#[cfg(io_safety_is_in_std)]
#[cfg(unix)]
pub use std::os::unix::io::{AsFd, BorrowedFd, OwnedFd};
#[cfg(io_safety_is_in_std)]
#[cfg(target_os = "wasi")]
pub use std::os::wasi::io::{AsFd, BorrowedFd, OwnedFd};
#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
pub use std::os::windows::io::{
AsHandle, AsSocket, BorrowedHandle, BorrowedSocket, HandleOrInvalid, InvalidHandleError,
NullHandleError, OwnedHandle, OwnedSocket,
};
#[cfg(io_safety_is_in_std)]
#[cfg(any(unix, target_os = "wasi"))]
#[allow(deprecated)]
impl<T: From<OwnedFd>> FromFd for T {
#[inline]
fn from_fd(owned_fd: OwnedFd) -> Self {
owned_fd.into()
}
}
#[cfg(io_safety_is_in_std)]
#[cfg(any(unix, target_os = "wasi"))]
#[allow(deprecated)]
impl<T> IntoFd for T
where
OwnedFd: From<T>,
{
#[inline]
fn into_fd(self) -> OwnedFd {
self.into()
}
}
#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
#[allow(deprecated)]
impl<T: From<OwnedHandle>> FromHandle for T {
#[inline]
fn from_handle(owned_handle: OwnedHandle) -> Self {
owned_handle.into()
}
}
#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
#[allow(deprecated)]
impl<T> IntoHandle for T
where
OwnedHandle: From<T>,
{
#[inline]
fn into_handle(self) -> OwnedHandle {
self.into()
}
}
#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
#[allow(deprecated)]
impl<T: From<OwnedSocket>> FromSocket for T {
#[inline]
fn from_socket(owned_socket: OwnedSocket) -> Self {
owned_socket.into()
}
}
#[cfg(io_safety_is_in_std)]
#[cfg(windows)]
#[allow(deprecated)]
impl<T> IntoSocket for T
where
OwnedSocket: From<T>,
{
#[inline]
fn into_socket(self) -> OwnedSocket {
self.into()
}
}
pub use portability::{
AsFilelike, AsSocketlike, BorrowedFilelike, BorrowedSocketlike, FromFilelike, FromSocketlike,
IntoFilelike, IntoSocketlike, OwnedFilelike, OwnedSocketlike,
};
#[cfg(feature = "close")]
pub mod example_ffi;
pub mod raw;
pub mod views;
#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "async-std")]
mod impls_async_std;
#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "fs-err")]
mod impls_fs_err;
#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "mio")]
mod impls_mio;
#[cfg(not(target_os = "wasi"))]
#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "os_pipe")]
mod impls_os_pipe;
#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "socket2")]
mod impls_socket2;
#[cfg(not(io_safety_is_in_std))]
#[cfg(feature = "tokio")]
mod impls_tokio;