Struct libffi::middle::ClosureOnce
[−]
[src]
pub struct ClosureOnce { /* fields omitted */ }
A closure that owns needs-drop data.
This allows the closure’s callback to take ownership of the data, in which case the userdata will be gone if called again.
Methods
impl ClosureOnce
[src]
pub fn new<U: Any, R>(
cif: Cif,
callback: CallbackOnce<U, R>,
userdata: U
) -> Self
[src]
cif: Cif,
callback: CallbackOnce<U, R>,
userdata: U
) -> Self
Creates a new closure with owned userdata.
Arguments
cif
— describes the calling convention and argument and result typescallback
— the function to call when the closure is invokeduserdata
— the value to pass tocallback
along with the arguments when the closure is called
Result
The new closure.
pub fn code_ptr(&self) -> &unsafe extern "C" fn()
[src]
Obtains the callable code pointer for a closure.
Safety
The result needs to be transmuted to the correct type before it can be called. If the type is wrong then undefined behavior will result.
Trait Implementations
impl Debug for ClosureOnce
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more