tokio-compat icon indicating copy to clipboard operation
tokio-compat copied to clipboard

Compat for io

Open MOZGIII opened this issue 4 years ago • 2 comments

I need a compat layer for io::AsyncWrite and io::AsyncRead. Can you add it?

MOZGIII avatar Feb 25 '20 14:02 MOZGIII

@MOZGIII are you trying to adapt between tokio 0.1's Async{Read, Write} traits and tokio 0.2's? I'd definitely like to add this to tokio-compat; thanks for opening the issue.

In the meantime, a potential workaround is to use futures 0.3's io compat layer to turn tokio 0.1 AsyncRead and AsyncWrite into futures 0.3's versions, and then use tokio-util's compat module to convert the futures 0.3 AsyncRead/AsyncWrite traits into tokio 0.2's versions.

Of course, this is not ideal, and we should definitely provide a one-step compat layer here, but it'll work in the short term.

hawkw avatar Feb 25 '20 21:02 hawkw

Thanks! I couldn't figure this out, this should work for my current use case.

MOZGIII avatar Feb 25 '20 22:02 MOZGIII