You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
meta: update to std::future and release an alpha. #1201
The first alpha release will happen once the examples have been updated.
Reacted by Ryan Dahl, Eric Izoita, Alexander Irbis, Alex Gaynor, Jarred Nicholls, Marco Conte and Slanterns
Reacted by Kat Marchán, John Doneth, Jon Gjengset, Dror Levin, Clément Renault, tinaun, Miloš Vučenović, Izzy Lee, Taiki Endo, Denys Zariaiev and 15 more
Reacted by Lucio Franco, Florian Jacob, Daniel Faust, Izzy Lee, Linus Unnebäck, Alex Gaynor and Jarred Nicholls
Note: while the tokio-threadpool crate was updated, the tokio crate itself is currently hardcoded to current_thread runtime. We should probably open an issue for that.
I tried porting the required modules but couldn't quite figure out what the updated code should look like.
Is there a reason AsyncRead and AsyncWrite are not just reexported from futures? These are causing incompatibility problems for me. If it's not intentional, I'll send a PR.
Reacted by Jonas Bushart, Jeb Rosen, O01eg and slyngbaek
Thanks! With this I can now almost get things running (still tackling compat stuff). What I did notice though is that tokio-uds pulls in the tokio v0.1 crates because the dependency on it in tokio doesn't specify path ="../tokio-uds" I think:
FYI, proxy example at 914038e (rubdos/tokio/proxy-example) works now (with async fn accept()), but needs futures-preview. Feel free to pick that from my fork.
EDIT: accidentally pasted wrong commit. EDIT EDIT: accidentally thought to have pasted the wrong commit.
I've implemented a crate using futures-preview and now I'm trying to use it in my project with a master branch of tokio.
I'm getting this error:
error[E0277]: the trait bound `tokio_tcp::stream::TcpStream: futures_io::if_std::AsyncRead` is not satisfied
At this point, I know what's causing it, and that there is a workaround available to make tokio and futures-preview play nicely together (thanks to good people at rust's discord). I just wanted to share my current experience here, as well as the found workaround.
Reacted by Lucio Franco, hirrolot, Alexander Hirner and Kevin Stone
so far, that's been intentional. There's been desire to explore alternate method signatures.
What compatibility issues are there? With other libraries?
I might be missing something obvious, but it is awkward to use tokio::TcpStream and friends which implements tokio::AsyncRead/Write and reconcile that with much of the Futures API which expects its own AsyncRead/Write.
Is there an alternative to TcpStream that implements futures::Async* ?
I'm working on reimplementing blocking example, and I discovered that tokio_threadpool::blocking returns a Poll. This is not very ergonomic in the current state of futures; I would likely have to use something like futures::poll_fn if one exists, or write my own future wrapping it. Is that something that we would want to turn into an async fn?
Activity
rubdos commentedon Jun 29, 2019
I'll take some (if not all) examples on me. Feel free to ping me on Gitter, merge request incoming.
archseer commentedon Jul 9, 2019
Note: while the tokio-threadpool crate was updated, the tokio crate itself is currently hardcoded to current_thread runtime. We should probably open an issue for that.
I tried porting the required modules but couldn't quite figure out what the updated code should look like.
carllerche commentedon Jul 9, 2019
@archseer good call.
CryZe commentedon Jul 9, 2019
Is there a reason AsyncRead and AsyncWrite are not just reexported from futures? These are causing incompatibility problems for me. If it's not intentional, I'll send a PR.
seanmonstar commentedon Jul 9, 2019
@CryZe so far, that's been intentional. There's been desire to explore alternate method signatures.
What compatibility issues are there? With other libraries?
carllerche commentedon Jul 10, 2019
@archseer bringing back the multi-threaded runtime: #1280
archseer commentedon Jul 11, 2019
Thanks! With this I can now almost get things running (still tackling compat stuff). What I did notice though is that tokio-uds pulls in the tokio v0.1 crates because the dependency on it in tokio doesn't specify path ="../tokio-uds" I think:
https://github.com/tokio-rs/tokio/blob/master/tokio/Cargo.toml#L87
rubdos commentedon Jul 11, 2019
FYI, proxy example at 914038e (rubdos/tokio/proxy-example) works now (with
async fn accept()), but needsfutures-preview. Feel free to pick that from my fork.EDIT: accidentally pasted wrong commit.EDIT EDIT: accidentally thought to have pasted the wrong commit.rubdos commentedon Jul 11, 2019
Seems like all other examples depend on some decision like #1225, since some kind of
Streamtrait is basically required for nice async examples.alex commentedon Jul 21, 2019
Should
tokio-tlsbe checked off? The issue it points at was resolved.carllerche commentedon Jul 21, 2019
@alex thanks 👍
MOZGIII commentedon Jul 23, 2019
I've implemented a crate using
futures-previewand now I'm trying to use it in my project with amasterbranch oftokio.I'm getting this error:
At this point, I know what's causing it, and that there is a workaround available to make
tokioandfutures-previewplay nicely together (thanks to good people at rust's discord). I just wanted to share my current experience here, as well as the found workaround.osa1 commentedon Jul 28, 2019
I think "chat", "udp-codec" and "tinydb" examples can be checked off as well.
LucioFranco commentedon Jul 29, 2019
@osa1 thanks, its done!
An update, I think we want to get all the examples updated and do a final pass of the crates then we can start publishing alphas!
Proximyst commentedon Jul 30, 2019
You forgot the TCP echo on the examples list :)
rrichardson commentedon Aug 2, 2019
@seanmonstar wrote:
I might be missing something obvious, but it is awkward to use tokio::TcpStream and friends which implements tokio::AsyncRead/Write and reconcile that with much of the Futures API which expects its own AsyncRead/Write.
Is there an alternative to TcpStream that implements futures::Async* ?
agausmann commentedon Aug 2, 2019
I'm working on reimplementing
blockingexample, and I discovered thattokio_threadpool::blockingreturns aPoll. This is not very ergonomic in the current state of futures; I would likely have to use something likefutures::poll_fnif one exists, or write my own future wrapping it. Is that something that we would want to turn into anasync fn?LucioFranco commentedon Aug 2, 2019
@rrichardson you can use this compat layer for now https://github.com/nemo157/futures-tokio-compat/ we are still exploring the API a bit and the one in the futures crate isn't stable either.
@agausmann I believe we've been using https://github.com/tokio-rs/async/blob/master/async-util/src/future/poll_fn.rs#L34 but there is also https://docs.rs/futures-preview/0.3.0-alpha.17/futures/future/fn.poll_fn.html
tokio: rewrite print_each_packet example using async/await
tokio: rewrite print_each_packet example using async/await
tokio: rewrite print_each_packet example using async/await (#1446)
carllerche commentedon Aug 26, 2019
This was done! 🎉