Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Switch to stable Futures #3099

Open
tomaka opened this issue Jul 11, 2019 · 5 comments
Open

Switch to stable Futures #3099

tomaka opened this issue Jul 11, 2019 · 5 comments
Labels
I7-refactor Code needs refactoring. U2-some_time_soon Issue is worth doing soon.
Milestone

Comments

@tomaka
Copy link
Contributor

tomaka commented Jul 11, 2019

Instead of using futures 0.1, let's use futures from the Rust standard library!

@tomaka tomaka added the I7-refactor Code needs refactoring. label Jul 11, 2019
@tomaka tomaka added this to the As-and-when milestone Jul 11, 2019
@tomaka
Copy link
Contributor Author

tomaka commented Jul 12, 2019

Note that after async/await get stable, the general intention is that it should be possible to use non-'static futures.

In other words, we could write something like this:

impl Foo {
    // the returned `Future` borrows `self`
    fn next_item(&mut self) -> impl Future { ... }
}

This will considerably reduce the need for the Stream trait, which isn't stable, to point where we might be able to eliminate its use.

@tomaka
Copy link
Contributor Author

tomaka commented Jul 25, 2019

Stables futures don't have any equivalent to loop_fn, which grandpa unfortunately uses.
We're probably going to have to wait for async/await.

Here's my WIP, for future reference: https://gist.github.com/tomaka/8dbe4b2c2ca69a34a72000deb3c5ad92

@bkchr
Copy link
Member

bkchr commented Jul 29, 2019

Why not just implement a custom Future? Will make the code more readable.

@kigawas
Copy link
Contributor

kigawas commented Oct 18, 2019

And consider using tokio 0.2 when it's ready

@expenses
Copy link
Contributor

expenses commented Nov 29, 2019

Still waiting on:

  • hyper
  • libp2p
  • jsonrpc (or probably a switch to jsonrpsee)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
I7-refactor Code needs refactoring. U2-some_time_soon Issue is worth doing soon.
Projects
None yet
Development

No branches or pull requests

5 participants