macro_rules! table_init_callback {
($name:ident, |$info:ident| $body:block) => { ... };
}Expand description
Generates a panic-safe unsafe extern "C" table function init callback.
Emits unsafe extern "C" fn $name(info: duckdb_init_info). Use it for both
the global init and the per-thread local_init callback — they share a
signature. A panic is reported through duckdb_init_set_error.
Table functions only. duckdb_init_set_error casts its argument to the
table function’s info struct, which is much larger than a scalar
function’s: used on a scalar function, it wrote past the scalar init info
(SIGSEGV in testing). A scalar callback takes a
RawScalarInitInfo (feature duckdb-1-5), so the compiler
refuses this macro’s output there. Use scalar_init_callback! (feature
duckdb-1-5) for scalar functions.
§Example
quack_rs::table_init_callback!(my_init, |info| {
let init = unsafe { quack_rs::table::InitInfo::new(info) };
init.set_max_threads(1);
});