4 ms·
Here is an example: https://github.com/async-rs/async-std-hyper/blob/master/README.md https://github.com/async-rs/async-std-hyper/blob/master/READ... You do ha
by ibraheemdev 6y ago
Here is an example: https://github.com/async-rs/async-std-hyper/blob/master/README.md https://github.com/async-rs/async-std-hyper/blob/master/READ...
You do have to write a ~50 loc compat layer. However, most of the compat layer is due to the fact that tokio's `AsyncRead` and `AsyncWrite` are different from the standard futures crate, which may change in the future [0]. After that, you just have to implement `hyper::Executor` for async-std's `spawn`, and `hyper::Accept` for async-std's `TcpListener`.
Of course, it is not as generic as "Futures", but it is relatively simple to do. As @steveklabnik mentioned above:
> There's a few points here that still need some interop work. The intention is to fix that, but it's non-trivial. We'll get there.
[0]: https://github.com/tokio-rs/tokio/issues/2716 https://github.com/tokio-rs/tokio/issues/2716
- octoberfranklin 6y ago> tokio's `AsyncRead` and `AsyncWrite` are different from the standard futures The standard futures library does not have an AsyncRead or AsyncWrite: https://doc.rust-lang.org/std/future/index.html https://doc.rust-lang.org/std/future/index.html
- ben0x539 6y agoProbably in reference to https://docs.rs/futures/0.3.8/futures/io/trait.AsyncRead.html https://docs.rs/futures/0.3.8/futures/io/trait.AsyncRead.htm... vs https://docs.rs/tokio/1.0.0/tokio/io/trait.AsyncRead.html https://docs.rs/tokio/1.0.0/tokio/io/trait.AsyncRead.html
- ibraheemdev 6y agoYup, that is what I was referring to.
- deleted 6y ago[deleted]