Skip to main content

ProcVoidFunctionExt

Trait ProcVoidFunctionExt 

Source
pub trait ProcVoidFunctionExt: Sized {
    // Required methods
    fn from_fn<T: IProcInst>(
        callback: extern "C" fn(T, OptionalMethod),
    ) -> Option<Self>;
    fn from_fn_with_target<T: IProcInst, U: IProcInst>(
        target: T,
        callback: extern "C" fn(T, U, OptionalMethod),
    ) -> Option<Self>;
}

Required Methods§

Source

fn from_fn<T: IProcInst>( callback: extern "C" fn(T, OptionalMethod), ) -> Option<Self>

Wrap a Rust fn as a ProcVoidFunction (for Proc::call steps). The proc running the desc is handed to the callback by the VM itself, so there’s nothing to bind, the callback just receives that proc as its argument. Prefer this unless you need a bound object that differs from the running proc.

Source

fn from_fn_with_target<T: IProcInst, U: IProcInst>( target: T, callback: extern "C" fn(T, U, OptionalMethod), ) -> Option<Self>

Like from_fn, but also binds target. The callback receives (target, inst, methodinfo) where inst is the proc running the desc. Use this only when the object you want differs from the running proc. The target’s type is tied to the callback’s first parameter.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§