fn generate_rust_invocation(&self, function_args: &FunctionArgMetadata,ctx: &mut FunctionContext) -> TokenStream {

    
        // code to convert extract rust values from Js Env
        let js_to_rust_values = function_args.as_arg_token(&ctx);

        // express to invoke rust function
        let receiver = function_args.receiver();
        let rust_invoke = function_args.as_token_stream(self.name(),ctx);
        
        // if this is async, wrap with JsFuture
        let rust_invoke_ft_wrapper = if ctx.is_async {

            if self.has_default_output() {

                // since this doesn't have any output, we don't need return promise, we just
                // spawn async and return null ptr
                quote! {

                    node_bindgen::core::future::spawn(async move {
                        #rust_invoke.await;
                    });

                    Ok(std::ptr::null_mut())
                }

            } else {

                let async_name = format!("{}_ft", self.name());
                let async_lit = LitStr::new(&async_name, Span::call_site());
                quote! {
                    (node_bindgen::core::JsPromiseFuture::new(
                        #rust_invoke,#async_lit
                    )).try_to_js(&js_env)
                }
            }
        } else {
            quote! {
                #rust_invoke.try_to_js(&js_env)
            }
           
        };

        quote! {

            let result: Result<node_bindgen::sys::napi_value,node_bindgen::core::NjError> = ( move || {

                #js_to_rust_values

                #receiver

                #rust_invoke_ft_wrapper

            })();


            result.to_js(&js_env)
        }
    }
/// this code generation does following:
///
/// * extract arguments from napi environment based on rust function arguments type (including type checking)
/// * invoke rust function (including async wrapper)
/// * convert rust result back to JS
this code generation does following:
extract arguments from napi environment based on rust function arguments type (including type checking)
invoke rust function (including async wrapper)
convert rust result back to JS
this code generation does following : extract arguments from napi environment based on rust function arguments type ( including type checking ) invoke rust function ( including async wrapper ) convert rust result back to JS
fn generate_rust_invocation(&self, function_args: &FunctionArgMetadata,ctx: &mut FunctionContext) -> TokenStream {
        // code to convert extract rust values from Js Env
        let js_to_rust_values = function_args.as_arg_token(&ctx);
        // express to invoke rust function
        let receiver = function_args.receiver();
        let rust_invoke = function_args.as_token_stream(self.name(),ctx);
        // if this is async, wrap with JsFuture
        let rust_invoke_ft_wrapper = if ctx.is_async {
            if self.has_default_output() {
                // since this doesn't have any output, we don't need return promise, we just
                // spawn async and return null ptr
                quote! {
                    node_bindgen::core::future::spawn(async move {
                        #rust_invoke.await;
                    });
                    Ok(std::ptr::null_mut())
                }
            } else {
                let async_name = format!("{}_ft", self.name());
                let async_lit = LitStr::new(&async_name, Span::call_site());
                quote! {
                    (node_bindgen::core::JsPromiseFuture::new(
                        #rust_invoke,#async_lit
                    )).try_to_js(&js_env)
                }
            }
        } else {
            quote! {
                #rust_invoke.try_to_js(&js_env)
            }
        };
        quote! {
            let result: Result<node_bindgen::sys::napi_value,node_bindgen::core::NjError> = ( move || {
                #js_to_rust_values
                #receiver
                #rust_invoke_ft_wrapper
            })();
            result.to_js(&js_env)
        }
    }
fn generate_rust_invocation ( & self , function_args : & FunctionArgMetadata , ctx : & mut FunctionContext ) -> TokenStream { // code to convert extract rust values from Js Env let js_to_rust_values = function_args . as_arg_token ( & ctx ) ; // express to invoke rust function let receiver = function_args . receiver ( ) ; let rust_invoke = function_args . as_token_stream ( self . name ( ) , ctx ) ; // if this is async, wrap with JsFuture let rust_invoke_ft_wrapper = if ctx . is_async { if self . has_default_output ( ) { // since this doesn't have any output, we don't need return promise, we just // spawn async and return null ptr quote ! { node_bindgen core future spawn ( async move { rust_invoke await } ) Ok ( std ptr null_mut ( ) ) } } else { let async_name = format ! ( " " self name ( ) ) ; let async_lit = LitStr :: new ( & async_name , Span :: call_site ( ) ) ; quote ! { ( node_bindgen core JsPromiseFuture new ( rust_invoke async_lit ) ) try_to_js ( js_env ) } } } else { quote ! { rust_invoke try_to_js ( js_env ) } } ; quote ! { let result Result node_bindgen sys napi_value node_bindgen core NjError ( move { js_to_rust_values receiver rust_invoke_ft_wrapper } ) ( ) result to_js ( js_env ) } }
this code generation does following:
 extract arguments from napi environment based on rust function arguments type (including type checking)
 invoke rust function (including async wrapper)
 convert rust result back to JS
this code generation does following : extract arguments from napi environment based on rust function arguments type ( including type checking ) invoke rust function ( including async wrapper ) convert rust result back to JS
&self
function_args
&FunctionArgMetadata
ctx
&mut FunctionContext