#![allow(unsafe_code)]
use core::ffi::c_void;
use crate::panic_guard::FfiBoundary;
use crate::runtime::{EngineContext, FfiPtr};
use crate::sys;
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__ft_init(ctx: *mut EngineContext) -> i32 {
FfiBoundary::run(|| {
unsafe { &mut *ctx }.engine_mut().ft_init()
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__ft_init_ext(
ctx: *mut EngineContext,
flags: u32,
inx: u32,
key: *const sys::MysqlString,
) -> *mut c_void {
FfiBoundary::run_default(core::ptr::null_mut(), || {
let engine = unsafe { &mut *ctx }.engine_mut();
let key = unsafe { key.as_ref() };
engine.ft_init_ext(flags, inx, key)
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__ft_init_ext_with_hints(
ctx: *mut EngineContext,
flags: u32,
inx: u32,
key: *const sys::MysqlString,
hints: *const sys::FtHints,
) -> *mut c_void {
FfiBoundary::run_default(core::ptr::null_mut(), || {
let engine = unsafe { &mut *ctx }.engine_mut();
let key = unsafe { key.as_ref() };
let hints = unsafe { hints.as_ref() };
engine.ft_init_ext_with_hints(flags, inx, key, hints)
})
}
#[doc(hidden)]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn rust__handler__ft_read(
ctx: *mut EngineContext,
buf: *mut u8,
buf_len: usize,
) -> i32 {
FfiBoundary::run(|| {
let engine = unsafe { &mut *ctx }.engine_mut();
engine.ft_read(unsafe { FfiPtr::slice_mut(buf, buf_len) })
})
}