Make sure scalar functions and hooks are Sendable

This commit is contained in:
gwenn 2018-08-15 18:30:18 +02:00
parent ec53f19be1
commit 4770060396
2 changed files with 8 additions and 8 deletions

View File

@ -230,7 +230,7 @@ impl Connection {
x_func: F, x_func: F,
) -> Result<()> ) -> Result<()>
where where
F: FnMut(&Context) -> Result<T>, F: FnMut(&Context) -> Result<T> + Send,
T: ToSql, T: ToSql,
{ {
self.db self.db
@ -281,7 +281,7 @@ impl InnerConnection {
x_func: F, x_func: F,
) -> Result<()> ) -> Result<()>
where where
F: FnMut(&Context) -> Result<T>, F: FnMut(&Context) -> Result<T> + Send,
T: ToSql, T: ToSql,
{ {
unsafe extern "C" fn call_boxed_closure<F, T>( unsafe extern "C" fn call_boxed_closure<F, T>(

View File

@ -96,7 +96,7 @@ impl Connection {
/// The callback returns `true` to rollback. /// The callback returns `true` to rollback.
pub fn commit_hook<F>(&self, hook: Option<F>) pub fn commit_hook<F>(&self, hook: Option<F>)
where where
F: FnMut() -> bool, F: FnMut() -> bool + Send,
{ {
self.db.borrow_mut().commit_hook(hook); self.db.borrow_mut().commit_hook(hook);
} }
@ -106,7 +106,7 @@ impl Connection {
/// The callback returns `true` to rollback. /// The callback returns `true` to rollback.
pub fn rollback_hook<F>(&self, hook: Option<F>) pub fn rollback_hook<F>(&self, hook: Option<F>)
where where
F: FnMut(), F: FnMut() + Send,
{ {
self.db.borrow_mut().rollback_hook(hook); self.db.borrow_mut().rollback_hook(hook);
} }
@ -122,7 +122,7 @@ impl Connection {
/// - the ROWID of the row that is updated. /// - the ROWID of the row that is updated.
pub fn update_hook<F>(&self, hook: Option<F>) pub fn update_hook<F>(&self, hook: Option<F>)
where where
F: FnMut(Action, &str, &str, i64), F: FnMut(Action, &str, &str, i64) + Send,
{ {
self.db.borrow_mut().update_hook(hook); self.db.borrow_mut().update_hook(hook);
} }
@ -137,7 +137,7 @@ impl InnerConnection {
fn commit_hook<F>(&mut self, hook: Option<F>) fn commit_hook<F>(&mut self, hook: Option<F>)
where where
F: FnMut() -> bool, F: FnMut() -> bool + Send,
{ {
unsafe extern "C" fn call_boxed_closure<F>(p_arg: *mut c_void) -> c_int unsafe extern "C" fn call_boxed_closure<F>(p_arg: *mut c_void) -> c_int
where where
@ -182,7 +182,7 @@ impl InnerConnection {
fn rollback_hook<F>(&mut self, hook: Option<F>) fn rollback_hook<F>(&mut self, hook: Option<F>)
where where
F: FnMut(), F: FnMut() + Send,
{ {
unsafe extern "C" fn call_boxed_closure<F>(p_arg: *mut c_void) unsafe extern "C" fn call_boxed_closure<F>(p_arg: *mut c_void)
where where
@ -221,7 +221,7 @@ impl InnerConnection {
fn update_hook<F>(&mut self, hook: Option<F>) fn update_hook<F>(&mut self, hook: Option<F>)
where where
F: FnMut(Action, &str, &str, i64), F: FnMut(Action, &str, &str, i64) + Send,
{ {
unsafe extern "C" fn call_boxed_closure<F>( unsafe extern "C" fn call_boxed_closure<F>(
p_arg: *mut c_void, p_arg: *mut c_void,