mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Reduce required lifetime in create_scalar_function
This commit is contained in:
parent
b0ade73f43
commit
749266cae9
@ -334,15 +334,15 @@ impl Connection {
|
|||||||
/// # Failure
|
/// # Failure
|
||||||
///
|
///
|
||||||
/// Will return Err if the function could not be attached to the connection.
|
/// Will return Err if the function could not be attached to the connection.
|
||||||
pub fn create_scalar_function<F, T>(
|
pub fn create_scalar_function<'a, F, T>(
|
||||||
&self,
|
&'a self,
|
||||||
fn_name: &str,
|
fn_name: &str,
|
||||||
n_arg: c_int,
|
n_arg: c_int,
|
||||||
flags: FunctionFlags,
|
flags: FunctionFlags,
|
||||||
x_func: F,
|
x_func: F,
|
||||||
) -> Result<()>
|
) -> Result<()>
|
||||||
where
|
where
|
||||||
F: FnMut(&Context<'_>) -> Result<T> + Send + UnwindSafe + 'static,
|
F: FnMut(&Context<'_>) -> Result<T> + Send + UnwindSafe + 'a,
|
||||||
T: ToSql,
|
T: ToSql,
|
||||||
{
|
{
|
||||||
self.db
|
self.db
|
||||||
@ -411,15 +411,15 @@ impl Connection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl InnerConnection {
|
impl InnerConnection {
|
||||||
fn create_scalar_function<F, T>(
|
fn create_scalar_function<'a, F, T>(
|
||||||
&mut self,
|
&'a mut self,
|
||||||
fn_name: &str,
|
fn_name: &str,
|
||||||
n_arg: c_int,
|
n_arg: c_int,
|
||||||
flags: FunctionFlags,
|
flags: FunctionFlags,
|
||||||
x_func: F,
|
x_func: F,
|
||||||
) -> Result<()>
|
) -> Result<()>
|
||||||
where
|
where
|
||||||
F: FnMut(&Context<'_>) -> Result<T> + Send + UnwindSafe + 'static,
|
F: FnMut(&Context<'_>) -> Result<T> + Send + UnwindSafe + 'a,
|
||||||
T: ToSql,
|
T: ToSql,
|
||||||
{
|
{
|
||||||
unsafe extern "C" fn call_boxed_closure<F, T>(
|
unsafe extern "C" fn call_boxed_closure<F, T>(
|
||||||
|
Loading…
Reference in New Issue
Block a user