pub fn msg<F, T>(&self, t: T, f: F)
    where
        F: FnMut(T),
        T: std::fmt::Debug + 'static,
    {
        // context structure which is passed to the callback as argument
        struct Ctx<F, T: std::fmt::Debug> {
            closure: F,
            args: T,
        }

        // helper routine to unpack the closure and its arguments
        extern "C" fn trampoline<F, T>(arg: *mut c_void)
        where
            F: FnMut(T),
            T: 'static + std::fmt::Debug,
        {
            let mut ctx = unsafe { Box::from_raw(arg as *mut Ctx<F, T>) };
            (ctx.closure)(ctx.args);
        }

        let ctx = Box::new(Ctx {
            closure: f,
            args: t,
        });

        let rc = unsafe {
            spdk_thread_send_msg(
                self.0.as_ptr(),
                Some(trampoline::<F, T>),
                Box::into_raw(ctx).cast(),
            )
        };
        assert_eq!(rc, 0);
    }
/// send the given thread 'msg' in xPDK speak.
send the given thread 'msg' in xPDK speak.
send the given thread ' msg ' in xPDK speak .
pub fn msg<F, T>(&self, t: T, f: F)
    where
        F: FnMut(T),
        T: std::fmt::Debug + 'static,
    {
        // context structure which is passed to the callback as argument
        struct Ctx<F, T: std::fmt::Debug> {
            closure: F,
            args: T,
        }
        // helper routine to unpack the closure and its arguments
        extern "C" fn trampoline<F, T>(arg: *mut c_void)
        where
            F: FnMut(T),
            T: 'static + std::fmt::Debug,
        {
            let mut ctx = unsafe { Box::from_raw(arg as *mut Ctx<F, T>) };
            (ctx.closure)(ctx.args);
        }
        let ctx = Box::new(Ctx {
            closure: f,
            args: t,
        });
        let rc = unsafe {
            spdk_thread_send_msg(
                self.0.as_ptr(),
                Some(trampoline::<F, T>),
                Box::into_raw(ctx).cast(),
            )
        };
        assert_eq!(rc, 0);
    }
pub fn msg < F , T > ( & self , t : T , f : F ) where F : FnMut ( T ) , T : std :: fmt :: Debug + ' static , { // context structure which is passed to the callback as argument struct Ctx < F , T : std :: fmt :: Debug > { closure : F , args : T , } // helper routine to unpack the closure and its arguments extern " " fn trampoline < F , T > ( arg : * mut c_void ) where F : FnMut ( T ) , T : ' static + std :: fmt :: Debug , { let mut ctx = unsafe { Box :: from_raw ( arg as * mut Ctx < F , T > ) } ; ( ctx . closure ) ( ctx . args ) ; } let ctx = Box :: new ( Ctx { closure : f , args : t , } ) ; let rc = unsafe { spdk_thread_send_msg ( self . 0 . as_ptr ( ) , Some ( trampoline :: < F , T > ) , Box :: into_raw ( ctx ) . cast ( ) , ) } ; assert_eq ! ( rc 0 ) ; }
send the given thread 'msg' in xPDK speak.
send the given thread ' msg ' in xPDK speak .
&self
t
T
f
F