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() - } -}