#![cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
#![allow(unsafe_code)]
use crate::backend::c;
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub type RawFd = c::c_int;
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
pub trait AsRawFd {
#[cfg_attr(staged_api, stable(feature = "rust1", since = "1.0.0"))]
fn as_raw_fd(&self) -> RawFd;
}
#[cfg_attr(staged_api, stable(feature = "from_raw_os", since = "1.1.0"))]
pub trait FromRawFd {
#[cfg_attr(staged_api, stable(feature = "from_raw_os", since = "1.1.0"))]
unsafe fn from_raw_fd(fd: RawFd) -> Self;
}
#[cfg_attr(staged_api, stable(feature = "into_raw_os", since = "1.4.0"))]
pub trait IntoRawFd {
#[cfg_attr(staged_api, stable(feature = "into_raw_os", since = "1.4.0"))]
fn into_raw_fd(self) -> RawFd;
}
#[cfg_attr(
staged_api,
stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")
)]
impl AsRawFd for RawFd {
#[inline]
fn as_raw_fd(&self) -> RawFd {
*self
}
}
#[cfg_attr(
staged_api,
stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")
)]
impl IntoRawFd for RawFd {
#[inline]
fn into_raw_fd(self) -> RawFd {
self
}
}
#[cfg_attr(
staged_api,
stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")
)]
impl FromRawFd for RawFd {
#[inline]
unsafe fn from_raw_fd(fd: RawFd) -> RawFd {
fd
}
}