diff --git a/ntex-io/src/io.rs b/ntex-io/src/io.rs index 8bedd1df..17e8ffb0 100644 --- a/ntex-io/src/io.rs +++ b/ntex-io/src/io.rs @@ -347,19 +347,12 @@ impl Io { poll_fn(|cx| self.poll_read_ready(cx)).await } - #[doc(hidden)] #[inline] - /// Wait until read becomes ready. + /// Wait until io reads any data. pub async fn read_notify(&self) -> io::Result> { poll_fn(|cx| self.poll_read_notify(cx)).await } - #[doc(hidden)] - #[deprecated] - pub async fn force_read_ready(&self) -> io::Result> { - poll_fn(|cx| self.poll_read_notify(cx)).await - } - #[inline] /// Pause read task pub fn pause(&self) { @@ -446,21 +439,8 @@ impl Io { } } - #[doc(hidden)] #[inline] - /// Polls for read readiness. - /// - /// If the io stream is not currently ready for reading, - /// this method will store a clone of the Waker from the provided Context. - /// When the io stream becomes ready for reading, Waker::wake will be called on the waker. - /// - /// Return value - /// The function returns: - /// - /// `Poll::Pending` if the io stream is not ready for reading. - /// `Poll::Ready(Ok(Some(()))))` if the io stream is ready for reading. - /// `Poll::Ready(Ok(None))` if io stream is disconnected - /// `Some(Poll::Ready(Err(e)))` if an error is encountered. + /// Polls for any incoming data. pub fn poll_read_notify(&self, cx: &mut Context<'_>) -> Poll>> { let ready = self.poll_read_ready(cx); @@ -477,15 +457,6 @@ impl Io { } } - #[doc(hidden)] - #[deprecated] - pub fn poll_force_read_ready( - &self, - cx: &mut Context<'_>, - ) -> Poll>> { - self.poll_read_notify(cx) - } - #[inline] /// Decode codec item from incoming bytes stream. /// diff --git a/ntex-io/src/lib.rs b/ntex-io/src/lib.rs index fb7a8867..cbfde011 100644 --- a/ntex-io/src/lib.rs +++ b/ntex-io/src/lib.rs @@ -2,9 +2,8 @@ #![deny(rust_2018_idioms, unreachable_pub, missing_debug_implementations)] #![allow(async_fn_in_trait)] -use std::{ - any::Any, any::TypeId, fmt, io as sio, io::Error as IoError, task::Context, task::Poll, -}; +use std::io::{Error as IoError, Result as IoResult}; +use std::{any::Any, any::TypeId, fmt, task::Context, task::Poll}; pub mod testing; pub mod types; @@ -39,16 +38,16 @@ pub use self::flags::Flags; #[doc(hidden)] pub trait AsyncRead { - async fn read(&mut self, buf: BytesVec) -> (BytesVec, sio::Result); + async fn read(&mut self, buf: BytesVec) -> (BytesVec, IoResult); } #[doc(hidden)] pub trait AsyncWrite { - async fn write(&mut self, buf: &mut WriteContextBuf) -> sio::Result<()>; + async fn write(&mut self, buf: &mut WriteContextBuf) -> IoResult<()>; - async fn flush(&mut self) -> sio::Result<()>; + async fn flush(&mut self) -> IoResult<()>; - async fn shutdown(&mut self) -> sio::Result<()>; + async fn shutdown(&mut self) -> IoResult<()>; } /// Status for read task @@ -90,10 +89,10 @@ pub trait FilterLayer: fmt::Debug + 'static { /// /// Inner filter must process buffer before current. /// Returns number of new bytes. - fn process_read_buf(&self, buf: &ReadBuf<'_>) -> sio::Result; + fn process_read_buf(&self, buf: &ReadBuf<'_>) -> IoResult; /// Process write buffer - fn process_write_buf(&self, buf: &WriteBuf<'_>) -> sio::Result<()>; + fn process_write_buf(&self, buf: &WriteBuf<'_>) -> IoResult<()>; #[inline] /// Query internal filter data @@ -103,7 +102,7 @@ pub trait FilterLayer: fmt::Debug + 'static { #[inline] /// Gracefully shutdown filter - fn shutdown(&self, buf: &WriteBuf<'_>) -> sio::Result> { + fn shutdown(&self, buf: &WriteBuf<'_>) -> IoResult> { Ok(Poll::Ready(())) } } @@ -126,7 +125,7 @@ pub enum IoStatusUpdate { /// Stop io stream handling Stop, /// Peer is disconnected - PeerGone(Option), + PeerGone(Option), } /// Recv error @@ -141,7 +140,7 @@ pub enum RecvError { /// Unrecoverable frame decoding errors Decoder(U::Error), /// Peer is disconnected - PeerGone(Option), + PeerGone(Option), } /// Dispatcher item