fn generate_rust_is_enabled(&self, provider: &ProviderTraitGenerator) -> TokenStream {
        if provider
            .build_info
            .implementation
            .tracing_target()
            .has_native_enabled_func()
        {
            quote! {}
        } else {
            let func_name = format!("{}_enabled", self.spec.name);
            let func_ident = syn::Ident::new(&func_name, self.spec.original_method.span());

            let semaphore_name = format!("{}_semaphore", self.spec.name).to_uppercase();
            let semaphore_ident =
                syn::Ident::new(&semaphore_name, self.spec.original_method.span());

            quote! {
                #[inline(always)]
                pub fn #func_ident() -> bool {
                    unsafe { std::ptr::read_volatile(&#semaphore_ident) != 0 }
                }
            }
        }
    }
/// Some tracing implementations will use a C++ native function that tests if a probe is
/// enabled or not.  Others use a static variable that the Rust code can query directly.  In
/// that latter case, we need to generate a Rust function in the impl mod to query this
/// variable.
///
/// Only the LTTng tracing target right now provides a native `_enabled` func, all others need
/// this Rust version
Some tracing implementations will use a C++ native function that tests if a probe is
enabled or not.  Others use a static variable that the Rust code can query directly.  In
that latter case, we need to generate a Rust function in the impl mod to query this
variable.

Only the LTTng tracing target right now provides a native `_enabled` func, all others need
this Rust version
Some tracing implementations will use a C ++ native function that tests if a probe is enabled or not . Others use a static variable that the Rust code can query directly . In that latter case we need to generate a Rust function in the impl mod to query this variable . Only the LTTng tracing target right now provides a native ` _enabled ` func all others need this Rust version
fn generate_rust_is_enabled(&self, provider: &ProviderTraitGenerator) -> TokenStream {
        if provider
            .build_info
            .implementation
            .tracing_target()
            .has_native_enabled_func()
        {
            quote! {}
        } else {
            let func_name = format!("{}_enabled", self.spec.name);
            let func_ident = syn::Ident::new(&func_name, self.spec.original_method.span());
            let semaphore_name = format!("{}_semaphore", self.spec.name).to_uppercase();
            let semaphore_ident =
                syn::Ident::new(&semaphore_name, self.spec.original_method.span());
            quote! {
                #[inline(always)]
                pub fn #func_ident() -> bool {
                    unsafe { std::ptr::read_volatile(&#semaphore_ident) != 0 }
                }
            }
        }
    }
fn generate_rust_is_enabled ( & self , provider : & ProviderTraitGenerator ) -> TokenStream { if provider . build_info . implementation . tracing_target ( ) . has_native_enabled_func ( ) { quote ! { } } else { let func_name = format ! ( " " self spec name ) ; let func_ident = syn :: Ident :: new ( & func_name , self . spec . original_method . span ( ) ) ; let semaphore_name = format ! ( " " self spec name ) . to_uppercase ( ) ; let semaphore_ident = syn :: Ident :: new ( & semaphore_name , self . spec . original_method . span ( ) ) ; quote ! { [ inline ( always ) ] pub fn func_ident ( ) bool { unsafe { std ptr read_volatile ( semaphore_ident ) 0 } } } } }
Some tracing implementations will use a C++ native function that tests if a probe is
enabled or not.
Some tracing implementations will use a C ++ native function that tests if a probe is enabled or not .
&self
provider
&ProviderTraitGenerator
&self
provider
&ProviderTraitGenerator