diff --git a/doc/src/zmqsource.rs b/doc/src/zmqsource.rs index cb57af79..8f18742b 100644 --- a/doc/src/zmqsource.rs +++ b/doc/src/zmqsource.rs @@ -202,7 +202,7 @@ where fn register( &mut self, - poll: &mut calloop::Poll, + poll: &calloop::Poll, token_factory: &mut calloop::TokenFactory, ) -> calloop::Result<()> { self.socket.register(poll, token_factory)?; @@ -216,7 +216,7 @@ where fn reregister( &mut self, - poll: &mut calloop::Poll, + poll: &calloop::Poll, token_factory: &mut calloop::TokenFactory, ) -> calloop::Result<()> { self.socket.reregister(poll, token_factory)?; @@ -228,7 +228,7 @@ where Ok(()) } - fn unregister(&mut self, poll: &mut calloop::Poll) -> calloop::Result<()> { + fn unregister(&mut self, poll: &calloop::Poll) -> calloop::Result<()> { self.socket.unregister(poll)?; self.mpsc_receiver.unregister(poll)?; self.wake_ping_receiver.unregister(poll)?; diff --git a/src/io.rs b/src/io.rs index 24f76410..76882936 100644 --- a/src/io.rs +++ b/src/io.rs @@ -202,7 +202,7 @@ trait IoLoopInner { impl<'l, Data> IoLoopInner for LoopInner<'l, Data> { unsafe fn register(&self, dispatcher: &RefCell) -> crate::Result<()> { let disp = dispatcher.borrow(); - self.poll.borrow_mut().register( + self.poll.register( unsafe { BorrowedFd::borrow_raw(disp.fd) }, Interest::EMPTY, Mode::OneShot, @@ -212,7 +212,7 @@ impl<'l, Data> IoLoopInner for LoopInner<'l, Data> { fn reregister(&self, dispatcher: &RefCell) -> crate::Result<()> { let disp = dispatcher.borrow(); - self.poll.borrow_mut().reregister( + self.poll.reregister( unsafe { BorrowedFd::borrow_raw(disp.fd) }, disp.interest, Mode::OneShot, @@ -263,7 +263,7 @@ impl EventDispatcher for RefCell { fn register( &self, - _: &mut Poll, + _: &Poll, _: &mut AdditionalLifecycleEventsSet, _: &mut TokenFactory, ) -> crate::Result<()> { @@ -273,7 +273,7 @@ impl EventDispatcher for RefCell { fn reregister( &self, - _: &mut Poll, + _: &Poll, _: &mut AdditionalLifecycleEventsSet, _: &mut TokenFactory, ) -> crate::Result { @@ -283,7 +283,7 @@ impl EventDispatcher for RefCell { fn unregister( &self, - poll: &mut Poll, + poll: &Poll, _: &mut AdditionalLifecycleEventsSet, _: RegistrationToken, ) -> crate::Result { diff --git a/src/loop_logic.rs b/src/loop_logic.rs index a1c5ebaa..b005011e 100644 --- a/src/loop_logic.rs +++ b/src/loop_logic.rs @@ -48,7 +48,7 @@ impl RegistrationToken { } pub(crate) struct LoopInner<'l, Data> { - pub(crate) poll: RefCell, + pub(crate) poll: Poll, // The `Option` is used to keep slots of the slab occipied, to prevent id reuse // while in-flight events might still referr to a recently destroyed event source. pub(crate) sources: RefCell>, @@ -57,7 +57,7 @@ pub(crate) struct LoopInner<'l, Data> { pending_action: Cell, } -/// An handle to an event loop +/// A handle to an event loop /// /// This handle allows you to insert new sources and idles in this event loop, /// it can be cloned, and it is possible to insert new sources from within a source @@ -121,7 +121,6 @@ impl<'l, Data> LoopHandle<'l, Data> { S: EventSource + 'l, { let mut sources = self.inner.sources.borrow_mut(); - let mut poll = self.inner.poll.borrow_mut(); // Find an empty slot if any let slot = sources.vacant_entry(); @@ -129,7 +128,7 @@ impl<'l, Data> LoopHandle<'l, Data> { slot.source = Some(dispatcher.clone_as_event_dispatcher()); trace!(source = slot.token.get_id(), "Inserting new source"); let ret = slot.source.as_ref().unwrap().register( - &mut poll, + &self.inner.poll, &mut self .inner .sources_with_additional_lifecycle_events @@ -173,7 +172,7 @@ impl<'l, Data> LoopHandle<'l, Data> { { trace!(source = entry_token.get_id(), "Registering source"); source.register( - &mut self.inner.poll.borrow_mut(), + &self.inner.poll, &mut self .inner .sources_with_additional_lifecycle_events @@ -200,7 +199,7 @@ impl<'l, Data> LoopHandle<'l, Data> { "Updating registration of source" ); if !source.reregister( - &mut self.inner.poll.borrow_mut(), + &self.inner.poll, &mut self .inner .sources_with_additional_lifecycle_events @@ -235,7 +234,7 @@ impl<'l, Data> LoopHandle<'l, Data> { } trace!(source = entry_token.get_id(), "Unregistering source"); if !source.unregister( - &mut self.inner.poll.borrow_mut(), + &self.inner.poll, &mut self .inner .sources_with_additional_lifecycle_events @@ -265,7 +264,7 @@ impl<'l, Data> LoopHandle<'l, Data> { if let Some(source) = source.take() { trace!(source = entry_token.get_id(), "Removing source"); if let Err(e) = source.unregister( - &mut self.inner.poll.borrow_mut(), + &self.inner.poll, &mut self .inner .sources_with_additional_lifecycle_events @@ -328,7 +327,7 @@ impl<'l, Data> EventLoop<'l, Data> { let poller = poll.poller.clone(); let handle = LoopHandle { inner: Rc::new(LoopInner { - poll: RefCell::new(poll), + poll, sources: RefCell::new(SourceList::new()), idles: RefCell::new(Vec::new()), pending_action: Cell::new(PostAction::Continue), @@ -382,11 +381,8 @@ impl<'l, Data> EventLoop<'l, Data> { } } let events = { - let poll = self.handle.inner.poll.borrow(); loop { - let result = poll.poll(timeout); - - match result { + match self.handle.inner.poll.poll(timeout) { Ok(events) => break events, Err(crate::Error::IoError(err)) if err.kind() == io::ErrorKind::Interrupted => { // Interrupted by a signal. Update timeout and retry. @@ -461,7 +457,7 @@ impl<'l, Data> EventLoop<'l, Data> { "Postaction reregister for source" ); disp.reregister( - &mut self.handle.inner.poll.borrow_mut(), + &self.handle.inner.poll, &mut self .handle .inner @@ -476,7 +472,7 @@ impl<'l, Data> EventLoop<'l, Data> { "Postaction unregister for source" ); disp.unregister( - &mut self.handle.inner.poll.borrow_mut(), + &self.handle.inner.poll, &mut self .handle .inner @@ -506,9 +502,8 @@ impl<'l, Data> EventLoop<'l, Data> { .unwrap_or(true) { // the source has been removed from within its callback, unregister it - let mut poll = self.handle.inner.poll.borrow_mut(); if let Err(e) = disp.unregister( - &mut poll, + &self.handle.inner.poll, &mut self .handle .inner @@ -559,7 +554,7 @@ impl<'l, Data> EventLoop<'l, Data> { pub fn get_signal(&self) -> LoopSignal { LoopSignal { signal: self.signals.clone(), - notifier: self.handle.inner.poll.borrow().notifier(), + notifier: self.handle.inner.poll.notifier(), } } @@ -952,7 +947,7 @@ mod tests { fn register( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.channel.register(poll, token_factory) @@ -960,13 +955,13 @@ mod tests { fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.channel.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { self.channel.unregister(poll) } @@ -1023,7 +1018,7 @@ mod tests { fn register( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.channel.register(poll, token_factory) @@ -1031,13 +1026,13 @@ mod tests { fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.channel.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { self.channel.unregister(poll) } @@ -1114,18 +1109,18 @@ mod tests { fn register( &mut self, - _: &mut Poll, + _: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.token = Some(token_factory.token()); Ok(()) } - fn reregister(&mut self, _: &mut Poll, _: &mut TokenFactory) -> crate::Result<()> { + fn reregister(&mut self, _: &Poll, _: &mut TokenFactory) -> crate::Result<()> { unreachable!() } - fn unregister(&mut self, _: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, _: &Poll) -> crate::Result<()> { unreachable!() } @@ -1272,7 +1267,7 @@ mod tests { fn register( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.ping1.register(poll, token_factory)?; @@ -1282,7 +1277,7 @@ mod tests { fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.ping1.reregister(poll, token_factory)?; @@ -1290,7 +1285,7 @@ mod tests { Ok(()) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { self.ping1.unregister(poll)?; self.ping2.unregister(poll)?; Ok(()) @@ -1607,7 +1602,7 @@ mod tests { Ok(PostAction::Remove) } - fn register(&mut self, _: &mut Poll, fact: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, _: &Poll, fact: &mut TokenFactory) -> crate::Result<()> { // produce a few tokens to emulate a subsource fact.token(); fact.token(); @@ -1615,11 +1610,11 @@ mod tests { Ok(()) } - fn reregister(&mut self, _: &mut Poll, _: &mut TokenFactory) -> crate::Result<()> { + fn reregister(&mut self, _: &Poll, _: &mut TokenFactory) -> crate::Result<()> { Ok(()) } - fn unregister(&mut self, _: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, _: &Poll) -> crate::Result<()> { Ok(()) } @@ -1675,15 +1670,15 @@ mod tests { Ok(PostAction::Continue) } - fn register(&mut self, _: &mut Poll, _: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, _: &Poll, _: &mut TokenFactory) -> crate::Result<()> { Ok(()) } - fn reregister(&mut self, _: &mut Poll, _: &mut TokenFactory) -> crate::Result<()> { + fn reregister(&mut self, _: &Poll, _: &mut TokenFactory) -> crate::Result<()> { Ok(()) } - fn unregister(&mut self, _: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, _: &Poll) -> crate::Result<()> { Ok(()) } } diff --git a/src/macros.rs b/src/macros.rs index 2ae5317c..1b77a455 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -140,7 +140,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { crate::batch_register!(poll, token_factory, self.ping0, self.ping1, self.ping2) @@ -148,13 +148,13 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { crate::batch_reregister!(poll, token_factory, self.ping0, self.ping1, self.ping2) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { crate::batch_unregister!(poll, self.ping0, self.ping1, self.ping2) } } diff --git a/src/sources/channel.rs b/src/sources/channel.rs index 49f439ea..35a092fd 100644 --- a/src/sources/channel.rs +++ b/src/sources/channel.rs @@ -246,19 +246,19 @@ impl EventSource for Channel { } } - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { self.source.register(poll, token_factory) } fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.source.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { self.source.unregister(poll) } } diff --git a/src/sources/futures.rs b/src/sources/futures.rs index 553f131f..e957721e 100644 --- a/src/sources/futures.rs +++ b/src/sources/futures.rs @@ -367,21 +367,21 @@ impl EventSource for Executor { } } - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { self.source.register(poll, token_factory)?; Ok(()) } fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.source.reregister(poll, token_factory)?; Ok(()) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { self.source.unregister(poll)?; Ok(()) } diff --git a/src/sources/generic.rs b/src/sources/generic.rs index 9f98fead..d62f8a85 100644 --- a/src/sources/generic.rs +++ b/src/sources/generic.rs @@ -290,7 +290,7 @@ where callback(readiness, self.file.as_mut().unwrap()) } - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { let token = token_factory.token(); // SAFETY: We ensure that we have a poller to deregister with (see below). @@ -315,7 +315,7 @@ where fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { let token = token_factory.token(); @@ -331,7 +331,7 @@ where Ok(()) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { poll.unregister(&self.file.as_ref().unwrap().0)?; self.poller = None; self.token = None; diff --git a/src/sources/mod.rs b/src/sources/mod.rs index 58f59b73..c865dc1f 100644 --- a/src/sources/mod.rs +++ b/src/sources/mod.rs @@ -148,7 +148,7 @@ pub trait EventSource { /// /// If you need to register more than one file descriptor, you can change the /// `sub_id` field of the [`Token`](crate::Token) to differentiate between them. - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()>; + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()>; /// Re-register your file descriptors /// @@ -157,7 +157,7 @@ pub trait EventSource { /// if necessary. fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()>; @@ -165,7 +165,7 @@ pub trait EventSource { /// /// You should unregister all your file descriptors from this [`Poll`](crate::Poll) using its /// [`Poll::unregister`](crate::Poll#method.unregister) method. - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()>; + fn unregister(&mut self, poll: &Poll) -> crate::Result<()>; /// Whether this source needs to be sent the [`EventSource::before_sleep`] /// and [`EventSource::before_handle_events`] notifications. These are opt-in because @@ -221,19 +221,19 @@ impl EventSource for Box { T::process_events(&mut **self, readiness, token, callback) } - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { T::register(&mut **self, poll, token_factory) } fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { T::reregister(&mut **self, poll, token_factory) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { T::unregister(&mut **self, poll) } @@ -269,19 +269,19 @@ impl EventSource for &mut T { T::process_events(&mut **self, readiness, token, callback) } - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { T::register(&mut **self, poll, token_factory) } fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { T::reregister(&mut **self, poll, token_factory) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { T::unregister(&mut **self, poll) } @@ -330,7 +330,7 @@ where fn register( &self, - poll: &mut Poll, + poll: &Poll, additional_lifecycle_register: &mut AdditionalLifecycleEventsSet, token_factory: &mut TokenFactory, ) -> crate::Result<()> { @@ -344,7 +344,7 @@ where fn reregister( &self, - poll: &mut Poll, + poll: &Poll, additional_lifecycle_register: &mut AdditionalLifecycleEventsSet, token_factory: &mut TokenFactory, ) -> crate::Result { @@ -361,7 +361,7 @@ where fn unregister( &self, - poll: &mut Poll, + poll: &Poll, additional_lifecycle_register: &mut AdditionalLifecycleEventsSet, registration_token: RegistrationToken, ) -> crate::Result { @@ -399,21 +399,21 @@ pub(crate) trait EventDispatcher { fn register( &self, - poll: &mut Poll, + poll: &Poll, additional_lifecycle_register: &mut AdditionalLifecycleEventsSet, token_factory: &mut TokenFactory, ) -> crate::Result<()>; fn reregister( &self, - poll: &mut Poll, + poll: &Poll, additional_lifecycle_register: &mut AdditionalLifecycleEventsSet, token_factory: &mut TokenFactory, ) -> crate::Result; fn unregister( &self, - poll: &mut Poll, + poll: &Poll, additional_lifecycle_register: &mut AdditionalLifecycleEventsSet, registration_token: RegistrationToken, ) -> crate::Result; diff --git a/src/sources/ping/pipe.rs b/src/sources/ping/pipe.rs index 3cd7eac2..2faf0a11 100644 --- a/src/sources/ping/pipe.rs +++ b/src/sources/ping/pipe.rs @@ -113,19 +113,19 @@ impl EventSource for PingSource { .map_err(|e| PingError(e.into())) } - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { self.pipe.register(poll, token_factory) } fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.pipe.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { self.pipe.unregister(poll) } } diff --git a/src/sources/timer.rs b/src/sources/timer.rs index b6331c9d..9a426358 100644 --- a/src/sources/timer.rs +++ b/src/sources/timer.rs @@ -142,7 +142,7 @@ impl EventSource for Timer { Ok(PostAction::Continue) } - fn register(&mut self, poll: &mut Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { + fn register(&mut self, poll: &Poll, token_factory: &mut TokenFactory) -> crate::Result<()> { // Only register a deadline if we haven't overflowed. if let Some(deadline) = self.deadline { let wheel = poll.timers.clone(); @@ -160,14 +160,14 @@ impl EventSource for Timer { fn reregister( &mut self, - poll: &mut Poll, + poll: &Poll, token_factory: &mut TokenFactory, ) -> crate::Result<()> { self.unregister(poll)?; self.register(poll, token_factory) } - fn unregister(&mut self, poll: &mut Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &Poll) -> crate::Result<()> { if let Some(registration) = self.registration.take() { poll.timers.borrow_mut().cancel(registration.counter); } diff --git a/src/sources/transient.rs b/src/sources/transient.rs index 72d3154f..9a5d9777 100644 --- a/src/sources/transient.rs +++ b/src/sources/transient.rs @@ -294,7 +294,7 @@ impl crate::EventSource for TransientSource { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { match &mut self.state { @@ -318,7 +318,7 @@ impl crate::EventSource for TransientSource { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { match &mut self.state { @@ -345,7 +345,7 @@ impl crate::EventSource for TransientSource { Ok(()) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { match &mut self.state { TransientSourceState::Keep(source) | TransientSourceState::Register(source) @@ -414,7 +414,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.ping.register(poll, token_factory) @@ -422,13 +422,13 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.ping.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { self.ping.unregister(poll) } } @@ -561,7 +561,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.ping.register(poll, token_factory) @@ -569,13 +569,13 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.ping.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { self.ping.unregister(poll) } } @@ -604,7 +604,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.0.map(|inner| inner.id += 1); @@ -613,14 +613,14 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.0.map(|inner| inner.id += 1); self.0.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { self.0.map(|inner| inner.id += 1); self.0.unregister(poll) } @@ -710,7 +710,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.0.register(poll, token_factory) @@ -718,13 +718,13 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.0.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { self.0.unregister(poll) } } @@ -837,7 +837,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.registered = true; @@ -846,13 +846,13 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.source.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { self.registered = false; self.source.unregister(poll) } @@ -942,7 +942,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.current.register(poll, token_factory) @@ -950,13 +950,13 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.current.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { self.current.unregister(poll) } } @@ -1078,7 +1078,7 @@ mod tests { fn register( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.inner.register(poll, token_factory) @@ -1086,13 +1086,13 @@ mod tests { fn reregister( &mut self, - poll: &mut crate::Poll, + poll: &crate::Poll, token_factory: &mut crate::TokenFactory, ) -> crate::Result<()> { self.inner.reregister(poll, token_factory) } - fn unregister(&mut self, poll: &mut crate::Poll) -> crate::Result<()> { + fn unregister(&mut self, poll: &crate::Poll) -> crate::Result<()> { self.inner.unregister(poll) } } diff --git a/src/sys.rs b/src/sys.rs index 2efe6ab1..eb3e32f1 100644 --- a/src/sys.rs +++ b/src/sys.rs @@ -180,7 +180,7 @@ pub struct Poll { /// /// One can emulate level triggered events on top of oneshot events by just re-registering the /// file descriptor every time it is polled. However, this is not ideal, as it requires a - /// system call every time. It's better to use the intergrated system, if available. + /// system call every time. It's better to use the integrated system, if available. level_triggered: Option>>, pub(crate) timers: Rc>,