-
-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use async fn over a custom Future Type #284
Comments
I'm open to this but since I'll take an example from an existing method. from
to
Would you really be gaining much and what would the related cruft amount to? |
Sorry! I should have been a bit more clear with my intentions. My motivations are not largely technical. I am mostly thinking about understandability. For those coming from other languages, or at least not familiar with the history Rust's concurrency model, the use of a custom future might be a bit confusing. In the current documentation, taking your method example above, the documentation says the method returns a |
I've got you. To fill in missing context async can be used with functions that impl the Std libs Future trait. In the case of hubcaps the reqwest crate provides that impl. Since hubcaps meets async/await contract types you can use that syntax today. Here's an example from the repos list of examples https://github.com/softprops/hubcaps/blob/master/examples/pulls.rs |
Ye, I've noticed the same. I usually code without type hints from my editor. Reading the documentation about Labels denotes the return type as Maybe a better name would have been |
💡 Feature description
I would be willing to perform the change to convert from and get rid of the related cruft as a result. But I wanted to make sure that was a contribution this repo was up to receiving before doing it. This appears to be the most up-to-date and maintained GitHub integration for rust.
💻 Basic example
fn foo() -> Future<T>
to anasync fn foo() -> Result<T>
The text was updated successfully, but these errors were encountered: