12 releases (5 breaking)
0.6.0 | Jun 29, 2020 |
---|---|
0.5.1 | Jun 28, 2020 |
0.4.4 | Jun 27, 2020 |
0.3.0 | Jun 27, 2020 |
0.1.4 | Jun 26, 2020 |
#2208 in Rust patterns
67 downloads per month
5KB
Label
This crate is only used to re-export label-macros. No actual implementation is included in it.
lib.rs
:
Label
label
is a library that can be used to create custom attributes for functions, through which you can list them and perform actions on them.
Label uses no global state during the compilation process, to avoid incremental compilation breaking it.
Example
use label::create_label;
create_label!(fn test() -> ());
#[test::label]
fn my_fn() {
println!("Test!");
}
fn main() {
println!("calling all 'test' label");
// using iter you can go through all functions with this annotation.
for i in test::iter() {
i();
}
}
Label also supports labels on static
and const
variables, and iterating over the names of labeled items.
For more information about this, visit the docs on create_label
Dependencies
~1.5MB
~36K SLoC