I have the following function from the sqlite-vss Rust extension:
#[cfg(feature = "vector")]
#[link(name = "sqlite_vector0")]
extern "C" {
pub fn sqlite3_vector_init();
}
I would like to load this extension into my sqlite instance using sqlx. Here one the maintainers has recommended to directly call the function by passing the parameters. The defined signature takes no parameters but it is meant to work as a regular sqlite extension, meaning one needs to pass the db pointer an error pointer-pointer and api routines pointer.
However, I don’t know how can I coerce the function signature from the generated Rust code, so I can pass the raw pointers:
let mut connection = pool.acquire().await?;
let db_pointer = connection.lock_handle().await?;
unsafe {
sqlite3_vector_init( // expected 0 arguments, found 3
db_pointer.as_raw_handle(),
std::ptr::null_mut(),
std::ptr::null_mut(),
);
}
What’s the rust syntax to coerce the function call to anything that I can call?