I'm relatively new to Rust and I've encountered an issue while using a library. It's possible that I might be doing something incorrectly:
The ExecutionContext is using the same lifetime parameter for both the schema and the context parameters.
Currently, my schema has a 'static lifetime, and the context is created for each request. However, the compiler demands that the context also has a 'static lifetime.
pub fn execute<'a>(&self, ctx: &ExecutionContext<'a>) -> bool {
// `ctx` is a reference that is only valid in the method body
// lifetime `'a` defined here
self.filter.execute(ctx).unwrap_or(false)
// `ctx` escapes the method body here
// argument requires that `'a` must outlive `'static`
}
Problem:
I'm relatively new to Rust and I've encountered an issue while using a library. It's possible that I might be doing something incorrectly:
The
ExecutionContext
is using the same lifetime parameter for both the schema and the context parameters.Currently, my schema has a
'static
lifetime, and the context is created for each request. However, the compiler demands that the context also has a'static
lifetime.Is there something I might be doing incorrectly?