romio
romio copied to clipboard
add support for Read + Write for TcpStream and UnixStream
There is no way to convert stream objects to their underlying type, but in some cases it's useful to be able to perform blocking I/O, such as when wrapped in stream that handles WouldBlock error in some way.
The specific use case for this is https://github.com/dbcfd/tls-async which works around the issue using Compat<S> where S: AsyncRead + AsyncWrite, which implements 0.1 Futures Stream. However this won't work outside of 0.1 executor (e.g. Tokio), which makes the usage with Romio awkward. I'm not sure what's the best solution here, but I would assume reexporting mio interfaces is acceptable. This would allow the depending library to use Read + Write directly.