mirror of
https://github.com/isar/rusqlite.git
synced 2025-04-01 19:52:57 +08:00
Make sure scalar functions and hooks are Send
able
This commit is contained in:
parent
ec53f19be1
commit
4770060396
@ -230,7 +230,7 @@ impl Connection {
|
||||
x_func: F,
|
||||
) -> Result<()>
|
||||
where
|
||||
F: FnMut(&Context) -> Result<T>,
|
||||
F: FnMut(&Context) -> Result<T> + Send,
|
||||
T: ToSql,
|
||||
{
|
||||
self.db
|
||||
@ -281,7 +281,7 @@ impl InnerConnection {
|
||||
x_func: F,
|
||||
) -> Result<()>
|
||||
where
|
||||
F: FnMut(&Context) -> Result<T>,
|
||||
F: FnMut(&Context) -> Result<T> + Send,
|
||||
T: ToSql,
|
||||
{
|
||||
unsafe extern "C" fn call_boxed_closure<F, T>(
|
||||
|
12
src/hooks.rs
12
src/hooks.rs
@ -96,7 +96,7 @@ impl Connection {
|
||||
/// The callback returns `true` to rollback.
|
||||
pub fn commit_hook<F>(&self, hook: Option<F>)
|
||||
where
|
||||
F: FnMut() -> bool,
|
||||
F: FnMut() -> bool + Send,
|
||||
{
|
||||
self.db.borrow_mut().commit_hook(hook);
|
||||
}
|
||||
@ -106,7 +106,7 @@ impl Connection {
|
||||
/// The callback returns `true` to rollback.
|
||||
pub fn rollback_hook<F>(&self, hook: Option<F>)
|
||||
where
|
||||
F: FnMut(),
|
||||
F: FnMut() + Send,
|
||||
{
|
||||
self.db.borrow_mut().rollback_hook(hook);
|
||||
}
|
||||
@ -122,7 +122,7 @@ impl Connection {
|
||||
/// - the ROWID of the row that is updated.
|
||||
pub fn update_hook<F>(&self, hook: Option<F>)
|
||||
where
|
||||
F: FnMut(Action, &str, &str, i64),
|
||||
F: FnMut(Action, &str, &str, i64) + Send,
|
||||
{
|
||||
self.db.borrow_mut().update_hook(hook);
|
||||
}
|
||||
@ -137,7 +137,7 @@ impl InnerConnection {
|
||||
|
||||
fn commit_hook<F>(&mut self, hook: Option<F>)
|
||||
where
|
||||
F: FnMut() -> bool,
|
||||
F: FnMut() -> bool + Send,
|
||||
{
|
||||
unsafe extern "C" fn call_boxed_closure<F>(p_arg: *mut c_void) -> c_int
|
||||
where
|
||||
@ -182,7 +182,7 @@ impl InnerConnection {
|
||||
|
||||
fn rollback_hook<F>(&mut self, hook: Option<F>)
|
||||
where
|
||||
F: FnMut(),
|
||||
F: FnMut() + Send,
|
||||
{
|
||||
unsafe extern "C" fn call_boxed_closure<F>(p_arg: *mut c_void)
|
||||
where
|
||||
@ -221,7 +221,7 @@ impl InnerConnection {
|
||||
|
||||
fn update_hook<F>(&mut self, hook: Option<F>)
|
||||
where
|
||||
F: FnMut(Action, &str, &str, i64),
|
||||
F: FnMut(Action, &str, &str, i64) + Send,
|
||||
{
|
||||
unsafe extern "C" fn call_boxed_closure<F>(
|
||||
p_arg: *mut c_void,
|
||||
|
Loading…
x
Reference in New Issue
Block a user