mirror of
https://github.com/isar/rusqlite.git
synced 2025-04-02 20:42:58 +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,
|
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>(
|
||||||
|
12
src/hooks.rs
12
src/hooks.rs
@ -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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user