Skip to main content

FFI_ScalarFunction

Struct FFI_ScalarFunction 

Source
#[repr(C)]
pub struct FFI_ScalarFunction { pub ctx: *const c_void, pub name: unsafe extern "C" fn(ctx: *const c_void) -> *const c_char, pub get_return_field: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowSchema, args_count: usize, ret: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_int, pub call: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowArray, args_schemas: *const ArrowSchema, args_count: usize, ret_array: *mut ArrowArray, ret_schema: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_int, pub fini: unsafe extern "C" fn(ctx: *mut c_void), }
Expand description

Virtual function table for a scalar function.

The host calls methods through these function pointers. ctx is an opaque pointer owned by the module; the host never dereferences it directly.

Fields§

§ctx: *const c_void

Opaque module-side context pointer.

§name: unsafe extern "C" fn(ctx: *const c_void) -> *const c_char

Return the function name as a null-terminated UTF-8 string.

The returned pointer borrows from ctx and is valid until fini.

§get_return_field: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowSchema, args_count: usize, ret: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_int

Compute the output field given input fields.

args points to args_count Arrow field schemas (C Data Interface). On success, writes the result schema to *ret. On error, writes a null-terminated message to *errmsg (freed by FFI_Module::free_string).

Returns 0 on success, non-zero on error.

§call: unsafe extern "C" fn(ctx: *const c_void, args: *const ArrowArray, args_schemas: *const ArrowSchema, args_count: usize, ret_array: *mut ArrowArray, ret_schema: *mut ArrowSchema, errmsg: *mut *mut c_char) -> c_int

Evaluate the function on Arrow arrays via the C Data Interface.

On error, writes a null-terminated message to *errmsg (freed by FFI_Module::free_string).

Returns 0 on success, non-zero on error.

§fini: unsafe extern "C" fn(ctx: *mut c_void)

Finalize the function, freeing all owned resources.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.