#[repr(C)]pub struct DiplomatCallback<ReturnType> {
pub data: *mut c_void,
pub run_callback: unsafe extern "C" fn(*mut c_void, ...) -> ReturnType,
pub destructor: Option<unsafe extern "C" fn(*mut c_void)>,
}Expand description
Struct representing a callback from Rust into a foreign language
This is largely used internally by the Diplomat macro, and should not need to be constructed manually outside of that context
Fields§
§data: *mut c_voidAny data required to run the callback; e.g. a pointer to the callback wrapper object in the foreign runtime + the runtime itself
run_callback: unsafe extern "C" fn(*mut c_void, ...) -> ReturnTypeFunction to actually run the callback. Note the first param is mutable, but depending on if this is passed to a Fn or FnMut may not actually need to be. FFI-Callers of said functions should cast to mutable.
Takes in self.data and any number of additional arguments.
destructor: Option<unsafe extern "C" fn(*mut c_void)>Function to destroy this callback struct.
Takes in self.data
Trait Implementations§
Source§impl<ReturnType> Drop for DiplomatCallback<ReturnType>
impl<ReturnType> Drop for DiplomatCallback<ReturnType>
Auto Trait Implementations§
impl<ReturnType> Freeze for DiplomatCallback<ReturnType>
impl<ReturnType> RefUnwindSafe for DiplomatCallback<ReturnType>
impl<ReturnType> !Send for DiplomatCallback<ReturnType>
impl<ReturnType> !Sync for DiplomatCallback<ReturnType>
impl<ReturnType> Unpin for DiplomatCallback<ReturnType>
impl<ReturnType> UnsafeUnpin for DiplomatCallback<ReturnType>
impl<ReturnType> UnwindSafe for DiplomatCallback<ReturnType>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more