Skip to content

meta: update to std::future and release an alpha. #1201

Closed

Description

@carllerche

This issue tracks the progress of updating Tokio to use std::future.

Crates to update

Examples

The examples should be updated to idiomatic async / await syntax.

  • blocking
  • chat-combinator-current-thread
  • chat-combinator
  • chat
  • connect
  • echo-udp
  • echo
  • hello_world
  • manual-runtime
  • print_each_packet
  • proxy
  • tinydb
  • tinyhttp
  • udp-client
  • udp-codec

Additional functionality

Besides requiring crates to have transitioned to std::future, some examples are blocked on additional functionality being added.

Alpha release

The first alpha release will happen once the examples have been updated.

Activity

  1. added this to the v0.2 milestone on Jun 26, 2019
  2. rubdos commented on Jun 29, 2019

    @rubdos
    Contributor

    The first alpha release will happen once the examples have been updated.

    I'll take some (if not all) examples on me. Feel free to ping me on Gitter, merge request incoming.

  3. archseer commented on Jul 9, 2019

    @archseer

    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.

  4. carllerche commented on Jul 9, 2019

    @carllerche
    MemberAuthor

    @archseer good call.

  5. CryZe commented on Jul 9, 2019

    @CryZe

    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.

  6. seanmonstar commented on Jul 9, 2019

    @seanmonstar
    Member

    @CryZe so far, that's been intentional. There's been desire to explore alternate method signatures.

    What compatibility issues are there? With other libraries?

  7. carllerche commented on Jul 10, 2019

    @carllerche
    MemberAuthor

    @archseer bringing back the multi-threaded runtime: #1280

  8. archseer commented on Jul 11, 2019

    @archseer

    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

  9. rubdos commented on Jul 11, 2019

    @rubdos
    Contributor

    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.

  10. rubdos commented on Jul 11, 2019

    @rubdos
    Contributor

    Seems like all other examples depend on some decision like #1225, since some kind of Stream trait is basically required for nice async examples.

  11. alex commented on Jul 21, 2019

    @alex
    Contributor

    Should tokio-tls be checked off? The issue it points at was resolved.

  12. carllerche commented on Jul 21, 2019

    @carllerche
    MemberAuthor

    @alex thanks 👍

  13. MOZGIII commented on Jul 23, 2019

    @MOZGIII
    Contributor

    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.

  14. osa1 commented on Jul 28, 2019

    @osa1
    Contributor

    I think "chat", "udp-codec" and "tinydb" examples can be checked off as well.

  15. LucioFranco commented on Jul 29, 2019

    @LucioFranco
    Member

    @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!

  16. Proximyst commented on Jul 30, 2019

    @Proximyst

    You forgot the TCP echo on the examples list :)

  17. rrichardson commented on Aug 2, 2019

    @rrichardson
    Contributor

    @seanmonstar wrote:

    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* ?

  18. agausmann commented on Aug 2, 2019

    @agausmann

    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?

  19. LucioFranco commented on Aug 2, 2019

    @LucioFranco
    Member

    @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

  20. carllerche commented on Aug 26, 2019

    @carllerche
    MemberAuthor

    This was done! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions