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

Switch to async/await in client codegen #128

Closed
wafflespeanut opened this issue Oct 6, 2019 · 2 comments
Closed

Switch to async/await in client codegen #128

wafflespeanut opened this issue Oct 6, 2019 · 2 comments
Assignees
Labels
enhancement New feature or request epic A fair amount of work is involved research Some investigation required prior to making changes.

Comments

@wafflespeanut
Copy link
Collaborator

Since async/await has been stabilized and surf reaching 1.0, it's time to support surf alongside reqwest (both using async/await) and eventually add a feature gate for surf. This is also the best time to rethink how ApiClient and Sendable should be used throughout the codegen.

@wafflespeanut wafflespeanut added enhancement New feature or request epic A fair amount of work is involved research Some investigation required prior to making changes. labels Oct 6, 2019
@wafflespeanut wafflespeanut self-assigned this Oct 6, 2019
@wafflespeanut
Copy link
Collaborator Author

wafflespeanut commented Oct 6, 2019

async/await for reqwest and surf is blocked on rust-lang/rust#57017

The problem boiled down to having references to Sendable types across yield points (thereby requiring Sync bound) - in our case, it's the Response types. We can make use of move semantics in such a way that those methods which use the Response across yield points (usually body consumers) consume the response itself, process the body and return the tuple of response and body.

@wafflespeanut
Copy link
Collaborator Author

Fixed in b9eb2dd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request epic A fair amount of work is involved research Some investigation required prior to making changes.
Projects
None yet
Development

No branches or pull requests

1 participant