diff --git a/src/async_io.rs b/src/async_io.rs index cb5689c..5d95340 100644 --- a/src/async_io.rs +++ b/src/async_io.rs @@ -9,7 +9,7 @@ use std::task::{Context, Poll}; #[cfg(unix)] use std::{ - os::unix::io::AsRawFd, + os::unix::io::{AsRawFd, RawFd}, os::unix::net::{SocketAddr as UnixSocketAddr, UnixDatagram, UnixListener, UnixStream}, path::Path, }; @@ -54,6 +54,13 @@ impl Async { } } +#[cfg(unix)] +impl AsRawFd for Async { + fn as_raw_fd(&self) -> RawFd { + self.source.raw + } +} + #[cfg(windows)] impl Async { /// Converts a non-blocking I/O handle into an async I/O handle. @@ -67,6 +74,13 @@ impl Async { } } +#[cfg(windows)] +impl AsRawSocket for Async { + fn as_raw_socket(&self) -> RawSocket { + self.source.raw + } +} + impl Async { /// Gets a reference to the inner I/O handle. /// diff --git a/src/reactor.rs b/src/reactor.rs index 90c91c4..be6b02b 100644 --- a/src/reactor.rs +++ b/src/reactor.rs @@ -245,11 +245,11 @@ impl ReactorLock<'_> { pub(crate) struct Source { /// Raw file descriptor on Unix platforms. #[cfg(unix)] - raw: RawFd, + pub(crate) raw: RawFd, /// Raw socket handle on Windows. #[cfg(windows)] - raw: RawSocket, + pub(crate) raw: RawSocket, /// The ID of this source obtain during registration. key: usize,