Open JonRCahill opened 3 years ago
Presumably the macrology does not understand the lifetime parameter, but I have a similar need to carry a lifetime and would like to avoid having to do everything using the dynamic approach in order to make it work. Any known work-arounds here?
@JonRCahill @GavinMendelGleason this topic has been araised multiple times already across issues (https://github.com/graphql-rust/juniper/issues/143, https://github.com/graphql-rust/juniper/issues/105, https://github.com/graphql-rust/juniper/issues/364). Unfortunately, seems to be no handy way to have any lifetime parameters in Context
type at the moment. As far as I recall, the issue is not that much with juniper
macros expansion, but rather with some core type machinery or web-framework integration crates not being able to extract a Context
with lifetime from web-framework's request context. Try to do the manual extraction Context<'a>
inside the handler, not requiring it as a function argument.
I need to define a lifetime on my Context so I can gain access to Cookies in Rocket, but after defining the lifetime I get a compile error on the
get_graphql_handler
request handler.A simplified version (without the Cookies) which has the same compile error:
Results in the following compile errors:
I have created an example here: https://github.com/JonRCahill/juniper_context_lifetimes
Any ideas what I need to do to get this to compile?