fn generate_native_probe_func(&self, provider: &ProviderTraitGenerator) -> TokenStream {
        //Because of limitations in the tracing system, the name of the provider needs to
        //be fairly simple (no punctuation for example).  So we use the name of the trait,
        //converted to snake case.  Thus it's theoretically possible for there to be name
        //collisions.  That's why the name of the native library and the wrapper functions
        //are namespaced with a hash of the trait's source code, so if there is a
        //collision they will be disambiguated by the different implementation.  And, if
        //two crates happen to have the same exact provider trait declaration, then they'll
        //be treated as the same for tracing purposes.
        assert!(provider.build_info.implementation != TracingImplementation::Disabled);
        let is_real = provider
            .build_info
            .implementation
            .tracing_target()
            .is_enabled();
        let provider_name_with_hash = provider.spec.name_with_hash();

        let native_func_name = format!("{}_{}", provider_name_with_hash, self.spec.name);
        let func_attrs = if is_real {
            quote! { #[link_name = #native_func_name] }
        } else {
            quote! {}
        };
        let func_ident = &self.spec.method_name;

        let args = self.spec.args.iter().map(|arg| {
            let arg_name = arg.ident();
            let rust_typ: syn::Type = syn::parse_str(arg.arg_type_info().get_rust_type_str())
                .unwrap_or_else(|_| {
                    panic!(
                        "Failed to parse Rust type expression '{}'",
                        arg.arg_type_info().get_rust_type_str()
                    )
                });

            let span = arg.ident().span();
            quote_spanned! {span=>
                #arg_name: #rust_typ
            }
        });

        let func_body = if is_real {
            quote! { ; }
        } else {
            //The dummy no-op impl just pro-forma uses each argument to avoid a warning about
            //unused arguments
            let args_use = self.spec.args.iter().map(|arg| {
                let arg_name = arg.ident();

                let span = arg.ident().span();
                quote_spanned! {span=>
                    let _ = #arg_name;
                }
            });

            quote! {
                {
                    #(#args_use)*
                }
            }
        };

        let span = self.spec.original_method.span();
        quote_spanned! {span=>
            #func_attrs
            pub fn  #func_ident( #(#args),* ) #func_body
        }
    }
/// Generates just the "native" (in the `Disabled` or `NoOp` case it's actually just an empty
/// Rust function) function that fires the probe
Generates just the "native" (in the `Disabled` or `NoOp` case it's actually just an empty
Rust function) function that fires the probe
Generates just the " native " ( in the ` Disabled ` or ` NoOp ` case it ' s actually just an empty Rust function ) function that fires the probe
fn generate_native_probe_func(&self, provider: &ProviderTraitGenerator) -> TokenStream {
        //Because of limitations in the tracing system, the name of the provider needs to
        //be fairly simple (no punctuation for example).  So we use the name of the trait,
        //converted to snake case.  Thus it's theoretically possible for there to be name
        //collisions.  That's why the name of the native library and the wrapper functions
        //are namespaced with a hash of the trait's source code, so if there is a
        //collision they will be disambiguated by the different implementation.  And, if
        //two crates happen to have the same exact provider trait declaration, then they'll
        //be treated as the same for tracing purposes.
        assert!(provider.build_info.implementation != TracingImplementation::Disabled);
        let is_real = provider
            .build_info
            .implementation
            .tracing_target()
            .is_enabled();
        let provider_name_with_hash = provider.spec.name_with_hash();
        let native_func_name = format!("{}_{}", provider_name_with_hash, self.spec.name);
        let func_attrs = if is_real {
            quote! { #[link_name = #native_func_name] }
        } else {
            quote! {}
        };
        let func_ident = &self.spec.method_name;
        let args = self.spec.args.iter().map(|arg| {
            let arg_name = arg.ident();
            let rust_typ: syn::Type = syn::parse_str(arg.arg_type_info().get_rust_type_str())
                .unwrap_or_else(|_| {
                    panic!(
                        "Failed to parse Rust type expression '{}'",
                        arg.arg_type_info().get_rust_type_str()
                    )
                });
            let span = arg.ident().span();
            quote_spanned! {span=>
                #arg_name: #rust_typ
            }
        });
        let func_body = if is_real {
            quote! { ; }
        } else {
            //The dummy no-op impl just pro-forma uses each argument to avoid a warning about
            //unused arguments
            let args_use = self.spec.args.iter().map(|arg| {
                let arg_name = arg.ident();
                let span = arg.ident().span();
                quote_spanned! {span=>
                    let _ = #arg_name;
                }
            });
            quote! {
                {
                    #(#args_use)*
                }
            }
        };
        let span = self.spec.original_method.span();
        quote_spanned! {span=>
            #func_attrs
            pub fn  #func_ident( #(#args),* ) #func_body
        }
    }
fn generate_native_probe_func ( & self , provider : & ProviderTraitGenerator ) -> TokenStream { //Because of limitations in the tracing system, the name of the provider needs to //be fairly simple (no punctuation for example).  So we use the name of the trait, //converted to snake case.  Thus it's theoretically possible for there to be name //collisions.  That's why the name of the native library and the wrapper functions //are namespaced with a hash of the trait's source code, so if there is a //collision they will be disambiguated by the different implementation.  And, if //two crates happen to have the same exact provider trait declaration, then they'll //be treated as the same for tracing purposes. assert ! ( provider build_info implementation TracingImplementation Disabled ) ; let is_real = provider . build_info . implementation . tracing_target ( ) . is_enabled ( ) ; let provider_name_with_hash = provider . spec . name_with_hash ( ) ; let native_func_name = format ! ( " " provider_name_with_hash self spec name ) ; let func_attrs = if is_real { quote ! { [ link_name native_func_name ] } } else { quote ! { } } ; let func_ident = & self . spec . method_name ; let args = self . spec . args . iter ( ) . map ( | arg | { let arg_name = arg . ident ( ) ; let rust_typ : syn :: Type = syn :: parse_str ( arg . arg_type_info ( ) . get_rust_type_str ( ) ) . unwrap_or_else ( | _ | { panic ! ( " " arg arg_type_info ( ) get_rust_type_str ( ) ) } ) ; let span = arg . ident ( ) . span ( ) ; quote_spanned ! { span arg_name rust_typ } } ) ; let func_body = if is_real { quote ! { } } else { //The dummy no-op impl just pro-forma uses each argument to avoid a warning about //unused arguments let args_use = self . spec . args . iter ( ) . map ( | arg | { let arg_name = arg . ident ( ) ; let span = arg . ident ( ) . span ( ) ; quote_spanned ! { span let arg_name } } ) ; quote ! { { ( args_use ) } } } ; let span = self . spec . original_method . span ( ) ; quote_spanned ! { span func_attrs pub fn func_ident ( ( args ) ) func_body } }
Generates just the "native" (in the `Disabled` or `NoOp` case it's actually just an empty
Rust function) function that fires the probe
Generates just the " native " ( in the ` Disabled ` or ` NoOp ` case it ' s actually just an empty Rust function ) function that fires the probe
&self
provider
&ProviderTraitGenerator
&self
provider
&ProviderTraitGenerator