Skip to content

Commit

Permalink
util: impl AsRawFd/AsRawHandle for Compat<T> (#3765)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismooredev authored May 8, 2021
1 parent 2c5dc83 commit 05c3cf3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tokio-util/src/compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,17 @@ where
tokio::io::AsyncWrite::poll_shutdown(self.project().inner, cx)
}
}

#[cfg(unix)]
impl<T: std::os::unix::io::AsRawFd> std::os::unix::io::AsRawFd for Compat<T> {
fn as_raw_fd(&self) -> std::os::unix::io::RawFd {
self.inner.as_raw_fd()
}
}

#[cfg(windows)]
impl<T: std::os::windows::io::AsRawHandle> std::os::windows::io::AsRawHandle for Compat<T> {
fn as_raw_handle(&self) -> std::os::windows::io::RawHandle {
self.inner.as_raw_handle()
}
}

0 comments on commit 05c3cf3

Please sign in to comment.