pub fn impl_proto_wrap(cls: &syn::Type, name: &syn::Ident, spec: &FnSpec<'_>) -> TokenStream {
    let cb = impl_call(cls, name, &spec);
    let body = impl_arg_params(&spec, cb);

    quote! {
        #[allow(unused_mut)]
        unsafe extern "C" fn __wrap(
            _slf: *mut pyo3::ffi::PyObject,
            _args: *mut pyo3::ffi::PyObject,
            _kwargs: *mut pyo3::ffi::PyObject) -> *mut pyo3::ffi::PyObject
        {
            const _LOCATION: &'static str = concat!(stringify!(#cls),".",stringify!(#name),"()");
            let _py = pyo3::Python::assume_gil_acquired();
            let _pool = pyo3::GILPool::new(_py);
            let _slf = _py.mut_from_borrowed_ptr::<#cls>(_slf);
            let _args = _py.from_borrowed_ptr::<pyo3::types::PyTuple>(_args);
            let _kwargs: Option<&pyo3::types::PyDict> = _py.from_borrowed_ptr_or_opt(_kwargs);

            #body

            pyo3::callback::cb_convert(
                pyo3::callback::PyObjectCallbackConverter, _py, _result)
        }
    }
}
/// Generate function wrapper for protocol method (PyCFunction, PyCFunctionWithKeywords)
Generate function wrapper for protocol method (PyCFunction, PyCFunctionWithKeywords)
Generate function wrapper for protocol method ( PyCFunction PyCFunctionWithKeywords )
pub fn impl_proto_wrap(cls: &syn::Type, name: &syn::Ident, spec: &FnSpec<'_>) -> TokenStream {
    let cb = impl_call(cls, name, &spec);
    let body = impl_arg_params(&spec, cb);
    quote! {
        #[allow(unused_mut)]
        unsafe extern "C" fn __wrap(
            _slf: *mut pyo3::ffi::PyObject,
            _args: *mut pyo3::ffi::PyObject,
            _kwargs: *mut pyo3::ffi::PyObject) -> *mut pyo3::ffi::PyObject
        {
            const _LOCATION: &'static str = concat!(stringify!(#cls),".",stringify!(#name),"()");
            let _py = pyo3::Python::assume_gil_acquired();
            let _pool = pyo3::GILPool::new(_py);
            let _slf = _py.mut_from_borrowed_ptr::<#cls>(_slf);
            let _args = _py.from_borrowed_ptr::<pyo3::types::PyTuple>(_args);
            let _kwargs: Option<&pyo3::types::PyDict> = _py.from_borrowed_ptr_or_opt(_kwargs);
            #body
            pyo3::callback::cb_convert(
                pyo3::callback::PyObjectCallbackConverter, _py, _result)
        }
    }
}
pub fn impl_proto_wrap ( cls : & syn :: Type , name : & syn :: Ident , spec : & FnSpec < ' _ > ) -> TokenStream { let cb = impl_call ( cls , name , & spec ) ; let body = impl_arg_params ( & spec , cb ) ; quote ! { [ allow ( unused_mut ) ] unsafe extern " " fn __wrap ( _slf mut pyo3 ffi PyObject _args mut pyo3 ffi PyObject _kwargs mut pyo3 ffi PyObject ) mut pyo3 ffi PyObject { const _LOCATION ' static str concat ( stringify ( cls ) " " stringify ( name ) " " ) let _py pyo3 Python assume_gil_acquired ( ) let _pool pyo3 GILPool new ( _py ) let _slf _py mut_from_borrowed_ptr cls ( _slf ) let _args _py from_borrowed_ptr pyo3 types PyTuple ( _args ) let _kwargs Option pyo3 types PyDict _py from_borrowed_ptr_or_opt ( _kwargs ) body pyo3 callback cb_convert ( pyo3 callback PyObjectCallbackConverter _py _result ) } } }
Generate function wrapper for protocol method (PyCFunction, PyCFunctionWithKeywords)
Generate function wrapper for protocol method ( PyCFunction PyCFunctionWithKeywords )
cls
&syn::Type
name
&syn::Ident
spec
&FnSpec<'_>
cls
&syn::Type
name
&syn::Ident
spec
&FnSpec<'_>