1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-27 06:09:02 +02:00

Remove unused types in actix-tls. Add ActixStream impl for Box<dyn Ac… (#297)

This commit is contained in:
fakeshadow
2021-03-26 06:03:03 -07:00
committed by GitHub
parent a3c9ebc7fa
commit 12d3942b98
5 changed files with 27 additions and 140 deletions

View File

@ -87,7 +87,7 @@ pub mod net {
pub use tokio::net::{UnixDatagram, UnixListener, UnixStream};
/// Extension trait over async read+write types that can also signal readiness.
pub trait ActixStream: AsyncRead + AsyncWrite + Unpin + 'static {
pub trait ActixStream: AsyncRead + AsyncWrite + Unpin {
/// Poll stream and check read readiness of Self.
///
/// See [tokio::net::TcpStream::poll_read_ready] for detail on intended use.
@ -127,6 +127,16 @@ pub mod net {
ready.poll(cx)
}
}
impl<Io: ActixStream + ?Sized> ActixStream for Box<Io> {
fn poll_read_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<Ready>> {
(**self).poll_read_ready(cx)
}
fn poll_write_ready(&self, cx: &mut Context<'_>) -> Poll<io::Result<Ready>> {
(**self).poll_write_ready(cx)
}
}
}
pub mod time {