Crates.io | exonum_flamer |
lib.rs | exonum_flamer |
version | 0.1.6 |
source | src |
created_at | 2017-07-17 06:40:01.03879 |
updated_at | 2017-11-02 17:44:47.745372 |
description | a procedural macro to insert `flame::start_guard(_)` calls |
homepage | |
repository | https://github.com/exonum/exonum |
max_upload_size | |
id | 23719 |
size | 17,999 |
A plugin to insert appropriate flame::start_guard(_)
calls (for use with
flame)
This needs a nightly rustc! Because flamer is a compiler plugin, it uses unstable APIs, which are not available on stable or beta. It may be possible to extend flamer to allow use with syntex, but this hasn't been tried yet.
Usage:
In your Cargo.toml add flame
and flamer
to your dependencies:
[dependencies]
flame = "^0.1.9"
flamer = "^0.1.4"
Then in your crate root, add the following:
#![feature(plugin, custom_attribute)]
#![plugin(flamer)]
extern crate flame;
You may also opt for an optional dependency. In that case your Cargo.toml should have:
[dependencies]
flame = { version = "^0.1.9", optional = true }
flamer = { version = "^0.1.4", optional = true }
[features]
default = []
flame_it = ["flame", "flamer"]
And your crate root should contain:
#![cfg_attr(feature="flame_it", feature(plugin, custom_attribute))]
#![cfg_attr(feature="flame_it", plugin(flamer))]
#[cfg(feature="flame_it")]
extern crate flame;
// as well as the following instead of `#[flame]`
#[cfg_attr(feature="flame_it", flame)];
You should then be able to annotate every item (or even the whole crate) with
#[flame]
annotations. You can also use #[noflame]
annotations to disable
instrumentations for subitems of #[flame]
d items. Note that this only
instruments the annotated methods, it does not print out the results.
Refer to flame's documentation to see how output works.
License: Apache 2.0