From 749266cae927853be7c6cbd88f14ff57a15faf23 Mon Sep 17 00:00:00 2001 From: Nick Hynes Date: Sun, 25 Oct 2020 17:24:34 +0300 Subject: [PATCH] Reduce required lifetime in create_scalar_function --- src/functions.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index 3531391..b2e9256 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -334,15 +334,15 @@ impl Connection { /// # Failure /// /// Will return Err if the function could not be attached to the connection. - pub fn create_scalar_function( - &self, + pub fn create_scalar_function<'a, F, T>( + &'a self, fn_name: &str, n_arg: c_int, flags: FunctionFlags, x_func: F, ) -> Result<()> where - F: FnMut(&Context<'_>) -> Result + Send + UnwindSafe + 'static, + F: FnMut(&Context<'_>) -> Result + Send + UnwindSafe + 'a, T: ToSql, { self.db @@ -411,15 +411,15 @@ impl Connection { } impl InnerConnection { - fn create_scalar_function( - &mut self, + fn create_scalar_function<'a, F, T>( + &'a mut self, fn_name: &str, n_arg: c_int, flags: FunctionFlags, x_func: F, ) -> Result<()> where - F: FnMut(&Context<'_>) -> Result + Send + UnwindSafe + 'static, + F: FnMut(&Context<'_>) -> Result + Send + UnwindSafe + 'a, T: ToSql, { unsafe extern "C" fn call_boxed_closure(