Skip to main content

aggregate_destroy_callback

Macro aggregate_destroy_callback 

Source
macro_rules! aggregate_destroy_callback {
    ($name:ident, |$states:ident, $count:ident| $body:block) => { ... };
}
Expand description

Generates a panic-safe unsafe extern "C" aggregate state destructor.

Emits unsafe extern "C" fn $name(states: *mut duckdb_aggregate_state, count: idx_t).

This callback receives no info, so DuckDB offers no way to report an error from it. A panic is therefore caught and swallowed: that leaks whatever the destructor had not yet freed, which is strictly better than aborting the database process during query teardown.

ยงExample

quack_rs::aggregate_destroy_callback!(my_destroy, |states, count| {
    let _ = (states, count);
});