sqlite-functions 0.1.1

A small toolkit for authoring Rust functions for SQLite
Documentation
//! Implementation details used by [`crate::export_extension!`].

use std::os::raw::{c_char, c_int};

use rusqlite::{Connection, Result, ffi};

/// Bridge SQLite's C ABI to a safe registration function.
///
/// # Safety
///
/// All pointers must be the values SQLite supplied to an extension entry point.
pub unsafe fn initialize(
    db: *mut ffi::sqlite3,
    error_message: *mut *mut c_char,
    api: *mut ffi::sqlite3_api_routines,
    register: fn(Connection) -> Result<bool>,
) -> c_int {
    // SAFETY: The caller guarantees these are SQLite-owned extension pointers.
    unsafe { Connection::extension_init2(db, error_message, api, register) }
}