-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add support cfg_attr #23
Labels
Comments
Current workaround which helps at least for being able to completly disable compilation with metered: Create a fake attribute macro called /// No-op macro as work-around for https://github.com/magnet/metered-rs/issues/23.
#[doc(hidden)]
#[proc_macro_attribute]
pub fn measure(_: TokenStream, input: TokenStream) -> TokenStream {
input
} And use it when measuring is disabled: #[cfg(feature = "measure-audio")]
use metered::{metered, ResponseTime};
#[cfg(not(feature = "measure-audio"))]
use my_macros::measure;
// ... |
magnet
added
enhancement
New feature or request
help wanted
Extra attention is needed
labels
May 25, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
First: Extremely practical crate! Thanks!
I wanted to use Cargo features and
cfg_attr
in order to be able to activate/deactivate the compilation of metering or change which set of functions is going to be measured. However, I ran into the problem thatcfg_attr
complained aboutmeasure
not being an attribute.Example:
Is there any way to fix it? E.g. to make
measure
an actual attribute?The text was updated successfully, but these errors were encountered: