#[cfg(any(unix, target_os = "wasi", target_os = "hermit"))]
use crate::OwnedFd;
#[cfg(windows)]
use crate::{OwnedHandle, OwnedSocket};
#[cfg(any(unix, target_os = "wasi", target_os = "hermit"))]
#[deprecated(
since = "1.0.0",
note = "`IntoFd` is replaced by `From<...> for OwnedFd` or `Into<OwnedFd>`"
)]
pub trait IntoFd {
fn into_fd(self) -> OwnedFd;
}
#[cfg(windows)]
#[deprecated(
since = "1.0.0",
note = "`IntoHandle` is replaced by `From<...> for OwnedHandle` or `Into<OwnedHandle>`"
)]
pub trait IntoHandle {
fn into_handle(self) -> OwnedHandle;
}
#[cfg(windows)]
#[deprecated(
since = "1.0.0",
note = "`IntoSocket` is replaced by `From<...> for OwnedSocket` or `Into<OwnedSocket>`"
)]
pub trait IntoSocket {
fn into_socket(self) -> OwnedSocket;
}
#[cfg(any(unix, target_os = "wasi", target_os = "hermit"))]
pub trait FromFd {
#[deprecated(
since = "1.0.0",
note = "`FromFd::from_fd` is replaced by `From<OwnedFd>::from`"
)]
fn from_fd(owned: OwnedFd) -> Self;
#[inline]
fn from_into_fd<Owned: Into<OwnedFd>>(into_owned: Owned) -> Self
where
Self: Sized + From<OwnedFd>,
{
Self::from(into_owned.into())
}
}
#[cfg(windows)]
pub trait FromHandle {
#[deprecated(
since = "1.0.0",
note = "`FromHandle::from_handle` is replaced by `From<OwnedHandle>::from`"
)]
fn from_handle(owned: OwnedHandle) -> Self;
#[inline]
fn from_into_handle<Owned: Into<OwnedHandle>>(into_owned: Owned) -> Self
where
Self: Sized + From<OwnedHandle>,
{
Self::from(into_owned.into())
}
}
#[cfg(windows)]
pub trait FromSocket {
#[deprecated(
since = "1.0.0",
note = "`FromSocket::from_socket` is replaced by `From<OwnedSocket>::from`"
)]
fn from_socket(owned: OwnedSocket) -> Self;
#[inline]
fn from_into_socket<Owned: Into<OwnedSocket>>(into_owned: Owned) -> Self
where
Self: Sized + From<OwnedSocket>,
{
Self::from(into_owned.into())
}
}