Trait ffi_utils::callback::Callback
[−]
[src]
pub trait Callback { type Args: CallbackArgs; fn call(&self, user_data: *mut c_void, error: FfiResult, args: Self::Args); }
This trait allows us to treat callbacks with different number and type of arguments uniformly.
Associated Types
type Args: CallbackArgs
Arguments for the callback. Should be a tuple.
Required Methods
fn call(&self, user_data: *mut c_void, error: FfiResult, args: Self::Args)
Call the callback, passing the user data pointer, error code and any additional arguments.
Implementors
impl Callback for extern "C" fn(_: *mut c_void, _: FfiResult) type Args = ();
impl<T: CallbackArgs> Callback for extern "C" fn(_: *mut c_void, _: FfiResult, _: T) type Args = T;
impl<T: CallbackArgs> Callback for unsafe extern "C" fn(_: *mut c_void, _: FfiResult, _: T) type Args = T;
impl<T0: CallbackArgs, T1: CallbackArgs> Callback for extern "C" fn(_: *mut c_void, _: FfiResult, _: T0, _: T1) type Args = (T0, T1);
impl<T0: CallbackArgs, T1: CallbackArgs, T2: CallbackArgs> Callback for extern "C" fn(_: *mut c_void, _: FfiResult, _: T0, _: T1, _: T2) type Args = (T0, T1, T2);