diff --git a/src/os/windows.rs b/src/os/windows.rs index e2a56a9..ef853c0 100644 --- a/src/os/windows.rs +++ b/src/os/windows.rs @@ -69,7 +69,8 @@ impl Waitable { /// ``` pub fn new(handle: T) -> Result { Ok(Self(Async { - source: Reactor::get().insert_io(unsafe { Registration::new_waitable(&handle) })?, + source: Reactor::get() + .insert_io(unsafe { Registration::new_waitable(handle.as_handle()) })?, io: Some(handle), })) } diff --git a/src/reactor/windows.rs b/src/reactor/windows.rs index c0156a9..75233c9 100644 --- a/src/reactor/windows.rs +++ b/src/reactor/windows.rs @@ -5,8 +5,7 @@ use polling::{Event, PollMode, Poller}; use std::fmt; use std::io::Result; use std::os::windows::io::{ - AsHandle, AsRawHandle, AsRawSocket, AsSocket, BorrowedHandle, BorrowedSocket, RawHandle, - RawSocket, + AsRawHandle, AsRawSocket, BorrowedHandle, BorrowedSocket, RawHandle, RawSocket, }; /// The raw registration into the reactor. @@ -47,8 +46,8 @@ impl Registration { /// # Safety /// /// The provided file descriptor must be valid and not be closed while this object is alive. - pub(crate) unsafe fn new(f: impl AsSocket) -> Self { - Self::Socket(f.as_socket().as_raw_socket()) + pub(crate) unsafe fn new(f: BorrowedSocket<'_>) -> Self { + Self::Socket(f.as_raw_socket()) } /// Create a new [`Registration`] around a waitable handle. @@ -56,8 +55,8 @@ impl Registration { /// # Safety /// /// The provided handle must be valid and not be closed while this object is alive. - pub(crate) unsafe fn new_waitable(f: impl AsHandle) -> Self { - Self::Handle(f.as_handle().as_raw_handle()) + pub(crate) unsafe fn new_waitable(f: BorrowedHandle<'_>) -> Self { + Self::Handle(f.as_raw_handle()) } /// Registers the object into the reactor.