I am trying to create custom context that gets reused between invocations.
Here specifically trying to reuse mongodb client.
// ...initing mongo database
let custom_context = CustomContext {
mongo_database: Some(mongo_database),
};
lambda_runtime::run(handler_fn(|event: Request, ctx: Context| {
execute(event, ctx, &custom_context)
}))
Getting: Closure may outlive the current function, but it borrows custom_context, which is owned by the current function
Can handler_fn be used to support something like this?
I am trying to create custom context that gets reused between invocations.
Here specifically trying to reuse mongodb client.
Getting: Closure may outlive the current function, but it borrows
custom_context, which is owned by the current functionCan
handler_fnbe used to support something like this?