pub struct FfiBindData<T: 'static> { /* private fields */ }Expand description
Type-safe bind data wrapper for DuckDB table functions.
FfiBindData<T> boxes a T on the heap during bind and provides
safe access in subsequent phases. DuckDB owns the allocation lifetime
and calls the provided destroy callback when the query is done.
§Memory model
Implementations§
Source§impl<T: 'static> FfiBindData<T>
impl<T: 'static> FfiBindData<T>
Sourcepub unsafe fn set(info: duckdb_bind_info, data: T)
pub unsafe fn set(info: duckdb_bind_info, data: T)
Stores data as the bind data for this table function invocation.
Call this inside your bind callback to save configuration that will
be accessed in init and scan callbacks.
§Safety
infomust be a validduckdb_bind_infoprovided byDuckDBin a bind callback.- Must be called at most once per bind invocation; calling twice leaks the first allocation.
Sourcepub const fn get_from_bind<'a>(info: duckdb_bind_info) -> Option<&'a T>
pub const fn get_from_bind<'a>(info: duckdb_bind_info) -> Option<&'a T>
Retrieves a shared reference to the bind data from a bind callback.
Returns None if no bind data was set or the pointer is null.
§Safety
infomust be a validduckdb_bind_info.- No mutable reference to the same data must exist.
- The returned reference is valid for the duration of the bind callback.
Sourcepub unsafe fn get_from_init<'a>(info: duckdb_init_info) -> Option<&'a T>
pub unsafe fn get_from_init<'a>(info: duckdb_init_info) -> Option<&'a T>
Retrieves a shared reference to the bind data from a global init callback.
Returns None if no bind data was set or the pointer is null.
§Safety
infomust be a validduckdb_init_info.- No mutable reference to the same data must exist simultaneously.
- The returned reference is valid for the duration of the init callback.
Sourcepub unsafe fn get_from_function<'a>(info: duckdb_function_info) -> Option<&'a T>
pub unsafe fn get_from_function<'a>(info: duckdb_function_info) -> Option<&'a T>
Retrieves a shared reference to the bind data from a scan callback.
Returns None if no bind data was set or the pointer is null.
§Safety
infomust be a validduckdb_function_infofrom a scan callback.- No mutable reference to the same data must exist simultaneously.
- The returned reference is valid for the duration of the scan callback.