fn generate_tracer_struct(&self) -> TracersResult<TokenStream> {
        // From the probe specifications, generate the corresponding methods that will be on the probe
        // struct.
        let mut probe_methods: Vec<TokenStream> = Vec::new();
        let mod_name = self.get_provider_impl_mod_name();
        let struct_type_name = self.get_provider_impl_struct_type_name();
        let struct_type_path: syn::Path = parse_quote! { #mod_name::#struct_type_name };
        for probe in self.probes.iter() {
            probe_methods.push(probe.generate_trait_methods(self, &struct_type_path)?);
        }

        // Re-generate the trait method that we took as input, with the modifications to support
        // probing
        // This includes constructing documentation for this trait, using whatever doc strings are already applied by
        // the user, plus a section of our own that has information about the provider and how it
        // translates into the various implementations.
        //
        // Hence, the rather awkward `#[doc...]` bits

        let attrs = &self.spec.item_trait().attrs;
        let span = self.spec.item_trait().span();
        let ident = &self.spec.item_trait().ident;
        let vis = &self.spec.item_trait().vis;

        let mod_name = self.get_provider_impl_mod_name();
        let struct_type_name = self.get_provider_impl_struct_type_name();
        let trait_doc_comment = self.generate_trait_comment();
        let try_init_decl = self.generate_try_init_decl();

        //the __try_init_provider returns a Result.  In this no-op implementation, we'll hard-code
        //a successful result, with a string containing some metadata about the generated provider
        let provider_name = self.spec.name();
        let implementation = format!(
            "{}/{}",
            self.build_info.implementation.tracing_type().as_ref(),
            self.build_info.implementation.as_ref()
        );

        let version = env!("CARGO_PKG_VERSION");

        let result = quote_spanned! {span=>
            #(#attrs)*
            #trait_doc_comment
            #vis struct #ident;

            impl #ident {
                #(#probe_methods)*

                #try_init_decl {
                    let result = #mod_name::#struct_type_name::get();

                    // On success, translate from the probe struct to the informational message
                    result.map(|_| {
                        concat!(#provider_name, "::", #implementation, "::", #version)
                    })
                }
            }
        };

        Ok(result)
    }
/// A provider is described by the user as a `trait`, with methods corresponding to probes.
/// However it's actually implemented as a `struct` with no member fields, with static methods
/// implementing the probes.  Thus, given as input the `trait`, we produce a `struct` of the same
/// name whose implementation actually performs the firing of the probes.
A provider is described by the user as a `trait`, with methods corresponding to probes.
However it's actually implemented as a `struct` with no member fields, with static methods
implementing the probes.  Thus, given as input the `trait`, we produce a `struct` of the same
name whose implementation actually performs the firing of the probes.
A provider is described by the user as a ` trait ` with methods corresponding to probes . However it ' s actually implemented as a ` struct ` with no member fields with static methods implementing the probes . Thus given as input the ` trait ` we produce a ` struct ` of the same name whose implementation actually performs the firing of the probes .
fn generate_tracer_struct(&self) -> TracersResult<TokenStream> {
        // From the probe specifications, generate the corresponding methods that will be on the probe
        // struct.
        let mut probe_methods: Vec<TokenStream> = Vec::new();
        let mod_name = self.get_provider_impl_mod_name();
        let struct_type_name = self.get_provider_impl_struct_type_name();
        let struct_type_path: syn::Path = parse_quote! { #mod_name::#struct_type_name };
        for probe in self.probes.iter() {
            probe_methods.push(probe.generate_trait_methods(self, &struct_type_path)?);
        }
        // Re-generate the trait method that we took as input, with the modifications to support
        // probing
        // This includes constructing documentation for this trait, using whatever doc strings are already applied by
        // the user, plus a section of our own that has information about the provider and how it
        // translates into the various implementations.
        //
        // Hence, the rather awkward `#[doc...]` bits
        let attrs = &self.spec.item_trait().attrs;
        let span = self.spec.item_trait().span();
        let ident = &self.spec.item_trait().ident;
        let vis = &self.spec.item_trait().vis;
        let mod_name = self.get_provider_impl_mod_name();
        let struct_type_name = self.get_provider_impl_struct_type_name();
        let trait_doc_comment = self.generate_trait_comment();
        let try_init_decl = self.generate_try_init_decl();
        //the __try_init_provider returns a Result.  In this no-op implementation, we'll hard-code
        //a successful result, with a string containing some metadata about the generated provider
        let provider_name = self.spec.name();
        let implementation = format!(
            "{}/{}",
            self.build_info.implementation.tracing_type().as_ref(),
            self.build_info.implementation.as_ref()
        );
        let version = env!("CARGO_PKG_VERSION");
        let result = quote_spanned! {span=>
            #(#attrs)*
            #trait_doc_comment
            #vis struct #ident;
            impl #ident {
                #(#probe_methods)*
                #try_init_decl {
                    let result = #mod_name::#struct_type_name::get();
                    // On success, translate from the probe struct to the informational message
                    result.map(|_| {
                        concat!(#provider_name, "::", #implementation, "::", #version)
                    })
                }
            }
        };
        Ok(result)
    }
fn generate_tracer_struct ( & self ) -> TracersResult < TokenStream > { // From the probe specifications, generate the corresponding methods that will be on the probe // struct. let mut probe_methods : Vec < TokenStream > = Vec :: new ( ) ; let mod_name = self . get_provider_impl_mod_name ( ) ; let struct_type_name = self . get_provider_impl_struct_type_name ( ) ; let struct_type_path : syn :: Path = parse_quote ! { mod_name struct_type_name } ; for probe in self . probes . iter ( ) { probe_methods . push ( probe . generate_trait_methods ( self , & struct_type_path ) ? ) ; } // Re-generate the trait method that we took as input, with the modifications to support // probing // This includes constructing documentation for this trait, using whatever doc strings are already applied by // the user, plus a section of our own that has information about the provider and how it // translates into the various implementations. // // Hence, the rather awkward `#[doc...]` bits let attrs = & self . spec . item_trait ( ) . attrs ; let span = self . spec . item_trait ( ) . span ( ) ; let ident = & self . spec . item_trait ( ) . ident ; let vis = & self . spec . item_trait ( ) . vis ; let mod_name = self . get_provider_impl_mod_name ( ) ; let struct_type_name = self . get_provider_impl_struct_type_name ( ) ; let trait_doc_comment = self . generate_trait_comment ( ) ; let try_init_decl = self . generate_try_init_decl ( ) ; //the __try_init_provider returns a Result.  In this no-op implementation, we'll hard-code //a successful result, with a string containing some metadata about the generated provider let provider_name = self . spec . name ( ) ; let implementation = format ! ( " " self build_info implementation tracing_type ( ) as_ref ( ) self build_info implementation as_ref ( ) ) ; let version = env ! ( " " ) ; let result = quote_spanned ! { span ( attrs ) trait_doc_comment vis struct ident impl ident { ( probe_methods ) try_init_decl { let result mod_name struct_type_name get ( ) // On success, translate from the probe struct to the informational message result map ( { concat ( provider_name " " implementation " " version ) } ) } } } ; Ok ( result ) }
A provider is described by the user as a `trait`, with methods corresponding to probes.
A provider is described by the user as a ` trait ` with methods corresponding to probes .
&self
&self