-
Notifications
You must be signed in to change notification settings - Fork 654
Migrate FutureExt
examples to use await!
#1088
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Blocked on rust-lang/rust#52357 to be able to actually use EDIT: I didn't think it was worth it to migrate to a more complicated boilerplate using top-level |
Fix should be in the next nightly, will test and update tomorrow once that's out. |
I'll sign off as soon as soon as I see it building with the new nightly. Looks solid. One notable change I see is that you removed the prelude imports and used direct imports instead. I think that that's a great idea because it gives the reader a better understanding about what types and traits are involved. We should apply this style to all examples (not in this PR). |
futures-util/src/future/mod.rs
Outdated
/// #![feature(async_await, await_macro, futures_api)] | ||
/// # futures::executor::block_on(async { | ||
/// use futures::future::{self, FutureExt}; | ||
/// use futures::executor::{spawn_with_handle, ThreadPool}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not alphabetically ordered
futures-util/src/future/mod.rs
Outdated
/// // Note, unlike most examples this is written in the context of a | ||
/// // synchronous function to better illustrate the cross-thread aspect of | ||
/// // the `shared` combinator. | ||
/// | ||
/// use std::thread; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want separate std imports? During my refactorings for 0.3 I made it so that all imports are simply always bundled together alphabetically ordered and std
is treated like any other crate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I don't really mind either way.
Updated. There's now just one example that's failing to compile, I've |
futures-util/src/future/mod.rs
Outdated
@@ -214,18 +212,16 @@ pub trait FutureExt: Future { | |||
/// # Example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Singular: Usually we have plural there. The docs for the standard library also always use the plural here: "Examples"
Edit: There are some more below.
Issue is probably rust-lang/rust#49537, something to do with calling a function taking a closure inside a generator. |
No description provided.