From f84efe34948a813c9c17b3ae871d25aa5981d8f4 Mon Sep 17 00:00:00 2001 From: Jean Pierre Dudey Date: Thu, 26 Apr 2018 10:29:49 -0400 Subject: [PATCH] Remove the `poll_receive` method from `MonitorSocket`. The `poll_receive` method from `Inner` is used directly instead in the `Stream` implementation. Signed-off-by: Jean Pierre Dudey --- tokio-udev/src/lib.rs | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/tokio-udev/src/lib.rs b/tokio-udev/src/lib.rs index d006a8f..01d156f 100644 --- a/tokio-udev/src/lib.rs +++ b/tokio-udev/src/lib.rs @@ -106,15 +106,20 @@ impl MonitorSocket { fn new(monitor: mio_udev::MonitorSocket) -> MonitorSocket { MonitorSocket { inner: Mutex::new(Inner::new(monitor)), } } - - fn poll_receive(&mut self) -> Poll, io::Error> { - self.inner.lock().unwrap().poll_receive() - } } unsafe impl Send for MonitorSocket {} unsafe impl Sync for MonitorSocket {} +impl Stream for MonitorSocket { + type Item = mio_udev::Event; + type Error = io::Error; + + fn poll(&mut self) -> Poll, Self::Error> { + self.inner.lock().unwrap().poll_receive() + } +} + struct Inner { io: PollEvented, } @@ -139,12 +144,3 @@ impl Inner { } } - -impl Stream for MonitorSocket { - type Item = mio_udev::Event; - type Error = io::Error; - - fn poll(&mut self) -> Poll, Self::Error> { - self.poll_receive() - } -}