Re:Tokio 1.0 – async runtime for Rust
by ibraheemdev on Wednesday December 23, 2020 @04:36PM
(#25522512)
Here is an example: 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.
Re:Tokio 1.0 – async runtime for Rust
by octoberfranklin on Wednesday December 23, 2020 @09:36PM
(#25524567)
> tokio's `AsyncRead` and `AsyncWrite` are different from the standard futures
The standard futures library does not have an AsyncRead or AsyncWrite:
Re:Tokio 1.0 – async runtime for Rust
by ben0x539 on Wednesday December 23, 2020 @10:33PM
(#25524822)
Probably in reference to
https://docs.rs/futures/0.3.8/futures/io/trait.AsyncRead.htm...
vs
Re:Tokio 1.0 – async runtime for Rust
by ibraheemdev on Thursday December 24, 2020 @12:02AM
(#25525191)
Yup, that is what I was referring to.
do you have an example?
Either way, "can be configured" means that custom code for each runtime must be written, it is not like lets say "Futures", which can be used generically.