diff options
Diffstat (limited to 'tokio/src/io/poll_evented.rs')
-rw-r--r-- | tokio/src/io/poll_evented.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tokio/src/io/poll_evented.rs b/tokio/src/io/poll_evented.rs index 3a659610..0ecdb180 100644 --- a/tokio/src/io/poll_evented.rs +++ b/tokio/src/io/poll_evented.rs @@ -124,6 +124,14 @@ impl<E: Source> PollEvented<E> { pub(crate) fn registration(&self) -> &Registration { &self.registration } + + /// Deregister the inner io from the registration and returns a Result containing the inner io + #[cfg(feature = "net")] + pub(crate) fn into_inner(mut self) -> io::Result<E> { + let mut inner = self.io.take().unwrap(); // As io shouldn't ever be None, just unwrap here. + self.registration.deregister(&mut inner)?; + Ok(inner) + } } feature! { |