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
Drop async_trait #1556
base: master
Are you sure you want to change the base?
Drop async_trait #1556
Conversation
@matze Nice! I think we could potentially offer this as an opt-in during codegen? I don't think there is anything stopping us from support both since its mostly codegen and user callsite code that is affected. What do you think? |
|
@LucioFranco I tested but the initial caveat still holds, all crates using pre-generated services require either |
A similar PR is approved for axum, how do you think just breaking as well? |
I am not following what you mean by this?
I think we should if we can get it so it works for both and users can choose. |
I mean I don't see how this could ever work for both. |
e17975e
to
04e79a4
Compare
c3eaecc
to
6fcc971
Compare
Motivation
This change was born mostly out of curiosity rather than a serious attempt to get it in any time soon. The main motivation of course is to get rid of the
async_trait
macro and boxed futures in favor of recently stabilizedasync fn
in traits.Solution
Remove usage of the
async_trait
macro and adjust the server codegen parts to return desugaredimpl Future<…> + Send
because of the Send bound problem.Caveats
This requires a nightly compiler but with that passes all tests as well as some manual tests I performed.
The larger question to answer though is how this would be merged into tonic eventually.
tonic-health
andtonic-reflection
rely on generated code which prohibits a gradual, feature-based integration. Moreover, this would require quite a large bump of MSRV to 1.75.