flamer icon indicating copy to clipboard operation
flamer copied to clipboard

RFE: Marking all pub API of modules/structs at once

Open behnam opened this issue 7 years ago • 5 comments

It would be great to have a way of marking all pub fn of modules, structs, ... marked for flaming using one single command.

Currently, I add

#[cfg_attr(feature="flame_it", flame)]

to all pub fn of major modules and structs manually.

behnam avatar Jun 14 '17 10:06 behnam

To some degree (i.e. sans visibility constraint) could easily do this with apply_attr like this:

#![cfg_attr(feature = "flame_it", apply_attr(to(fns, impls(fns)), as_default(flame)))]

… will apply #[flame] to every directly contained fnor impl fn in the current scope.

</shameless plug>

regexident avatar Jun 14 '17 19:06 regexident

So you'd like a #[flame(pub)] annotation that only instruments public items?

llogiq avatar Jun 16 '17 09:06 llogiq

First, I didn't realize that I can do #![flame] and get the whole module flamed. That's awesome!

Now, after using that, I can see that being able to limit it to only pub fns would make it more usable. So, yes, something like [flame(pub)] would be great!

behnam avatar Jun 16 '17 20:06 behnam

Also, another thing I noticed is that #![flame] applies it to any used fn, as well. Any chance that can also be optional, so we can only apply it to thing belonging to the module itself?

behnam avatar Jun 16 '17 20:06 behnam

Huh? That one is new. I think it may have to do with some recent changes in the AST logic.

llogiq avatar Jun 18 '17 09:06 llogiq