I want to use rusqlite hooks, and using:
conn.update_hook(Some(|action, _dbname, tabler, rowid| {
let g = a.lock();
}));
yields:
error: implementation of `FnOnce` is not general enough
--> src/db.rs:399:8
|
399 | conn.update_hook(Some(|action, _dbname, table, rowid| {
| ^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
= note: closure with signature `fn(Action, &'2 str, &str, i64)` must implement `FnOnce<(Action, &'1 str, &str, i64)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(Action, &'2 str, &str, i64)>`, for some specific lifetime `'2`
error: implementation of `FnOnce` is not general enough
--> src/db.rs:399:8
|
399 | conn.update_hook(Some(|action, _dbname, table, rowid| {
| ^^^^^^^^^^^ implementation of `FnOnce` is not general enough
|
= note: closure with signature `fn(Action, &str, &'2 str, i64)` must implement `FnOnce<(Action, &str, &'1 str, i64)>`, for any lifetime `'1`...
= note: ...but it actually implements `FnOnce<(Action, &str, &'2 str, i64)>`, for some specific lifetime `'2`
The fix is:
conn.update_hook(Some(|action, _dbname: &str, table: &str, rowid| {
let g = a.lock();
}));
(Note explicit &str
on _dbname
and table
)
.. but why?