From 0942099c9848659e8f668ab74a43220e4a2f540b Mon Sep 17 00:00:00 2001 From: notgull Date: Mon, 1 May 2023 20:23:32 -0700 Subject: [PATCH] Fix failing tests --- src/os/iocp.rs | 16 ++++++++-------- tests/windows_waitable.rs | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/os/iocp.rs b/src/os/iocp.rs index a4ce501..a5e2d2f 100644 --- a/src/os/iocp.rs +++ b/src/os/iocp.rs @@ -82,14 +82,14 @@ pub trait PollerIocpExt: PollerSealed { /// let poller = Poller::new().unwrap(); /// /// // Add the child process to the poller. - /// poller.add_waitable(child, Event::both(0), PollMode::Oneshot).unwrap(); + /// poller.add_waitable(&child, Event::all(0), PollMode::Oneshot).unwrap(); /// /// // Wait for the child process to exit. /// let mut events = vec![]; /// poller.wait(&mut events, None).unwrap(); /// /// assert_eq!(events.len(), 1); - /// assert_eq!(events[0], Event::both(0)); + /// assert_eq!(events[0], Event::all(0)); /// ``` fn add_waitable( &self, @@ -123,17 +123,17 @@ pub trait PollerIocpExt: PollerSealed { /// let poller = Poller::new().unwrap(); /// /// // Add the child process to the poller. - /// poller.add_waitable(child, Event::both(0), PollMode::Oneshot).unwrap(); + /// poller.add_waitable(&child, Event::all(0), PollMode::Oneshot).unwrap(); /// /// // Wait for the child process to exit. /// let mut events = vec![]; /// poller.wait(&mut events, None).unwrap(); /// /// assert_eq!(events.len(), 1); - /// assert_eq!(events[0], Event::both(0)); + /// assert_eq!(events[0], Event::all(0)); /// /// // Modify the waitable handle. - /// poller.modify_waitable(child, Event::readable(0), PollMode::Oneshot).unwrap(); + /// poller.modify_waitable(&child, Event::readable(0), PollMode::Oneshot).unwrap(); /// ``` fn modify_waitable( &self, @@ -167,17 +167,17 @@ pub trait PollerIocpExt: PollerSealed { /// let poller = Poller::new().unwrap(); /// /// // Add the child process to the poller. - /// poller.add_waitable(child, Event::both(0), PollMode::Oneshot).unwrap(); + /// poller.add_waitable(&child, Event::all(0), PollMode::Oneshot).unwrap(); /// /// // Wait for the child process to exit. /// let mut events = vec![]; /// poller.wait(&mut events, None).unwrap(); /// /// assert_eq!(events.len(), 1); - /// assert_eq!(events[0], Event::both(0)); + /// assert_eq!(events[0], Event::all(0)); /// /// // Remove the waitable handle. - /// poller.remove_waitable(child).unwrap(); + /// poller.remove_waitable(&child).unwrap(); /// ``` fn remove_waitable(&self, handle: impl Waitable) -> io::Result<()>; } diff --git a/tests/windows_waitable.rs b/tests/windows_waitable.rs index c0a984f..ba2133d 100644 --- a/tests/windows_waitable.rs +++ b/tests/windows_waitable.rs @@ -43,7 +43,7 @@ impl EventHandle { /// Reset the event object. fn reset(&self) -> io::Result<()> { - if unsafe { ResetEvent(self.0 as _) } == 0 { + if unsafe { ResetEvent(self.0 as _) } != 0 { Ok(()) } else { Err(io::Error::last_os_error()) @@ -52,7 +52,7 @@ impl EventHandle { /// Set the event object. fn set(&self) -> io::Result<()> { - if unsafe { SetEvent(self.0 as _) } == 0 { + if unsafe { SetEvent(self.0 as _) } != 0 { Ok(()) } else { Err(io::Error::last_os_error())