fn as_sync_arg_token_stream(&self, _i: usize, closure_var: &Ident) -> TokenStream {

        let js_conversions: Vec<TokenStream> = self
            .ty
            .inputs
            .iter()
            .enumerate()
            .map(|(index, _path)| {
                let arg_name = format!("cb_arg{}", index);
                let var_name = Ident::new(&arg_name, Span::call_site());
                quote! {
                    #var_name,
                }
            })
            .collect();

        quote! {

            // invoke sync closure
            let result = (|| {
                let args = vec![
                    #(#js_conversions)*
                ];
                #closure_var.call(args)
            })();

            result.to_js(&js_env);

        }
    }
/// generate as argument to sync rust function or method
/// since this is closure, we generate closure
generate as argument to sync rust function or method
since this is closure, we generate closure
generate as argument to sync rust function or method since this is closure we generate closure
fn as_sync_arg_token_stream(&self, _i: usize, closure_var: &Ident) -> TokenStream {
        let js_conversions: Vec<TokenStream> = self
            .ty
            .inputs
            .iter()
            .enumerate()
            .map(|(index, _path)| {
                let arg_name = format!("cb_arg{}", index);
                let var_name = Ident::new(&arg_name, Span::call_site());
                quote! {
                    #var_name,
                }
            })
            .collect();
        quote! {
            // invoke sync closure
            let result = (|| {
                let args = vec![
                    #(#js_conversions)*
                ];
                #closure_var.call(args)
            })();
            result.to_js(&js_env);
        }
    }
fn as_sync_arg_token_stream ( & self , _i : usize , closure_var : & Ident ) -> TokenStream { let js_conversions : Vec < TokenStream > = self . ty . inputs . iter ( ) . enumerate ( ) . map ( | ( index , _path ) | { let arg_name = format ! ( " " index ) ; let var_name = Ident :: new ( & arg_name , Span :: call_site ( ) ) ; quote ! { var_name } } ) . collect ( ) ; quote ! { // invoke sync closure let result ( { let args vec [ ( js_conversions ) ] closure_var call ( args ) } ) ( ) result to_js ( js_env ) } }
generate as argument to sync rust function or method
since this is closure, we generate closure
generate as argument to sync rust function or method since this is closure we generate closure
&self
_i
usize
closure_var
&Ident