Make RawFd implement the RawFd traits
This commit is contained in:
parent
5e449b9adf
commit
82f5928ca6
3 changed files with 59 additions and 0 deletions
|
@ -62,6 +62,25 @@ pub trait IntoRawFd {
|
|||
fn into_raw_fd(self) -> RawFd;
|
||||
}
|
||||
|
||||
#[stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")]
|
||||
impl AsRawFd for RawFd {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
*self
|
||||
}
|
||||
}
|
||||
#[stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")]
|
||||
impl IntoRawFd for RawFd {
|
||||
fn as_raw_fd(self) -> RawFd {
|
||||
self
|
||||
}
|
||||
}
|
||||
#[stable(feature = "raw_fd_reflexive_traits", since = "1.48.0")]
|
||||
impl FromRawFd for RawFd {
|
||||
unsafe fn from_raw_fd(fd: RawFd) -> RawFd {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl AsRawFd for fs::File {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue