You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am trying to use proc macro attributes to automatically generate code to handle authorization and rate-limits for the different queries and mutations. Problem is, the function gets transformed into an async block and attributes get removed in the process.
The currently generated code inside the match arm matching the query/mutation name looks like this :
let f = asyncmove{let res:/* my function return type */ = asyncmove{/* get the context and function arguments *//* the code in my function */}.await;/* some code generated by juniper */};FutureExt::boxed(f)
Describe the solution you'd like
I believe it is possible to get the work done by keeping the function (and therefore its attributes):
let f = asyncmove{let res:FieldResult<Account> = {asyncfninner(/* original function arguments, including the context */) -> /* my function return type */{/* the code in my function */}/* get context and arguments */inner(/* context and arguments */).await};/* some code generated by juniper */};FutureExt::boxed(f)
Potential problems
Would it add any overhead? To me, it doesn't seem like it would, but I'm not an async expert
I've seen code that directly uses the executor variable to get the context. This type of code would get broken by this change since the executor will be "hidden" behind the function. But it sounds like a hacky and unnecessary way to get the context anyway.
I can make a pull request with the changes if this is ok since I like doing stuff with proc macros.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I am trying to use proc macro attributes to automatically generate code to handle authorization and rate-limits for the different queries and mutations. Problem is, the function gets transformed into an async block and attributes get removed in the process.
The currently generated code inside the match arm matching the query/mutation name looks like this :
Describe the solution you'd like
I believe it is possible to get the work done by keeping the function (and therefore its attributes):
Potential problems
I can make a pull request with the changes if this is ok since I like doing stuff with proc macros.
The text was updated successfully, but these errors were encountered: