From a7f0899f1236505113efc9d9b56666cceb6bc5e4 Mon Sep 17 00:00:00 2001 From: Chris Moore <35407569+csm123199@users.noreply.github.com> Date: Sat, 8 May 2021 01:42:17 +0000 Subject: [PATCH] util: impl AsRawFd/AsRawHandle for Compat --- tokio-util/src/compat.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tokio-util/src/compat.rs b/tokio-util/src/compat.rs index a1fad4ab59a..4e13ac52e2a 100644 --- a/tokio-util/src/compat.rs +++ b/tokio-util/src/compat.rs @@ -215,3 +215,17 @@ where tokio::io::AsyncWrite::poll_shutdown(self.project().inner, cx) } } + +#[cfg(unix)] +impl std::os::unix::io::AsRawFd for Compat { + fn as_raw_fd(&self) -> std::os::unix::io::RawFd { + self.inner.as_raw_fd() + } +} + +#[cfg(windows)] +impl std::os::windows::io::AsRawHandle for Compat { + fn as_raw_handle(&self) -> std::os::windows::io::RawHandle { + self.inner.as_raw_handle() + } +}