Hi,
i have the following scenario. I have a Transport trait that shall implement AsyncRead and AsyncWrite:
pub trait Transport : AsyncRead + AsyncWrite { }
For this trait i have two implementation, one is based on tokio::net::TcpStream and the other on tokio_openssl::SslStream
In the end both implmentation are like the tcp one having a different new function:
pub struct TcpTransport {
stream: TcpStream,
}
Now i wanted to implement AsyncRead and AsyncWrite that will just redirect calls to the corresponding stream, e.g.:
impl AsyncRead for TcpTransport {
fn poll_read(self: std::pin::Pin<&mut Self>, cx: &mut std::task::Context<'_>, buf: &mut tokio::io::ReadBuf<'_>) -> std::task::Poll<std::io::Result<()>> {
self.stream.poll_read();
}
}
But this results in
error[E0599]: no method named 'poll_read' found for struct 'tokio::net::TcpStream' in the current scope