Skip to content
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

Implement IntoFuture trait for RequestBuilder in autorust for autogenerated services #1193

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

johnbatty
Copy link
Contributor

@johnbatty johnbatty commented Jan 11, 2023

Implement support for the new std::future::IntoFuture trait on request builder objects.

This eliminates the need to call into_future() on request builders, as .await automatically invokes into_future() if the IntoFuture trait is implemented.

This change simplifies the API. However, it is a breaking API change for existing users.

The change requires Rust 1.64.0 or higher. This is enforced via the rust-version field in Cargo.toml for each of the generated crates.

I also updated the documentation for RequestBuilder to provide more guidance on usage, and to help users locate the return type (which now appears on the IntoFuture::into_future() method in the traits section) . See this example from my azure_devops_rust_api crate docs for how the final documentation looks.

Fixes: #1189

@johnbatty johnbatty marked this pull request as draft January 11, 2023 23:12
@johnbatty johnbatty marked this pull request as ready for review January 11, 2023 23:35
Copy link
Member

@cataggar cataggar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic! ❤️

@demoray demoray merged commit 1a14e19 into Azure:main Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement IntoFuture trait in services
3 participants