fn instrument_precise(
    args: attr::InstrumentArgs,
    item: proc_macro::TokenStream,
) -> Result<proc_macro::TokenStream, syn::Error> {
    let input = syn::parse::<ItemFn>(item)?;
    let instrumented_function_name = input.sig.ident.to_string();

    // check for async_trait-like patterns in the block, and instrument
    // the future instead of the wrapper
    if let Some(async_trait) = expand::AsyncTraitInfo::from_fn(&input) {
        return Ok(async_trait.gen_async_trait(args, instrumented_function_name.as_str()));
    }

    Ok(expand::gen_function(
        (&input).into(),
        args,
        instrumented_function_name.as_str(),
        None,
    )
    .into())
}
/// Instrument the function, by fully parsing the function body,
/// which allows us to rewrite some statements related to async_trait-like patterns.
Instrument the function, by fully parsing the function body,
which allows us to rewrite some statements related to async_trait-like patterns.
Instrument the function by fully parsing the function body which allows us to rewrite some statements related to async_trait - like patterns .
fn instrument_precise(
    args: attr::InstrumentArgs,
    item: proc_macro::TokenStream,
) -> Result<proc_macro::TokenStream, syn::Error> {
    let input = syn::parse::<ItemFn>(item)?;
    let instrumented_function_name = input.sig.ident.to_string();
    // check for async_trait-like patterns in the block, and instrument
    // the future instead of the wrapper
    if let Some(async_trait) = expand::AsyncTraitInfo::from_fn(&input) {
        return Ok(async_trait.gen_async_trait(args, instrumented_function_name.as_str()));
    }
    Ok(expand::gen_function(
        (&input).into(),
        args,
        instrumented_function_name.as_str(),
        None,
    )
    .into())
}
fn instrument_precise ( args : attr :: InstrumentArgs , item : proc_macro :: TokenStream , ) -> Result < proc_macro :: TokenStream , syn :: Error > { let input = syn :: parse :: < ItemFn > ( item ) ? ; let instrumented_function_name = input . sig . ident . to_string ( ) ; // check for async_trait-like patterns in the block, and instrument // the future instead of the wrapper if let Some ( async_trait ) = expand :: AsyncTraitInfo :: from_fn ( & input ) { return Ok ( async_trait . gen_async_trait ( args , instrumented_function_name . as_str ( ) ) ) ; } Ok ( expand :: gen_function ( ( & input ) . into ( ) , args , instrumented_function_name . as_str ( ) , None , ) . into ( ) ) }
Instrument the function, by fully parsing the function body,
which allows us to rewrite some statements related to async_trait-like patterns.
Instrument the function by fully parsing the function body which allows us to rewrite some statements related to async_trait - like patterns .
args
attr::InstrumentArgs
item
proc_macro::TokenStream