tonic icon indicating copy to clipboard operation
tonic copied to clipboard

feat: support `async_trait`-less generation

Open jrandolf opened this issue 1 year ago • 2 comments

Motivation

async_trait is not necessary for most use-cases. This PR provides the option for users.

Solution

Providing an option to generate async traits without async_trait.

Fixed: https://github.com/hyperium/tonic/issues/1651

jrandolf avatar May 09 '24 04:05 jrandolf

@LucioFranco Note that the current CI doesn't test all feature combinations. We should use cargo hack --feature-powerset test to ensure all features are covered.

jrandolf avatar May 24 '24 20:05 jrandolf

I think we need to generate the code as fn foo() -> impl Future + Send to allow sendable futures. We also need to check if the generated functions will work with the Arc since that also needs Sync. I would like to move in this direction but I don't feel like there is a huge rush. I would like to see some more tests as well checking all the permutations of sendiness/syncness so that we know this will work for users.

LucioFranco avatar Jun 19 '24 19:06 LucioFranco