Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
behnam opened this issue Jun 14, 2017 · 5 comments
Open

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

behnam opened this issue Jun 14, 2017 · 5 comments

Comments

@behnam
Copy link

behnam commented Jun 14, 2017

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.

@regexident
Copy link
Collaborator

regexident commented Jun 14, 2017

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>

@llogiq
Copy link
Owner

llogiq commented Jun 16, 2017

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

@behnam
Copy link
Author

behnam commented Jun 16, 2017

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
Copy link
Author

behnam commented Jun 16, 2017

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?

@llogiq
Copy link
Owner

llogiq commented Jun 18, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants