15 breaking releases
new 0.21.0 | Mar 16, 2024 |
---|---|
0.19.0 | Mar 16, 2024 |
0.3.0 | Oct 21, 2023 |
0.1.2 | May 25, 2022 |
0.1.1 | Jan 15, 2022 |
#927 in Development tools
2,066 downloads per month
Used in 50 crates
(5 directly)
88KB
2K
SLoC
Module :: proc_macro_tools
Tools for writing procedural macros.
Basic use-case
#[ cfg( feature = "enabled" ) ]
{
use macro_tools::exposed::*;
let code = qt!( core::option::Option< i8, i16, i32, i64 > );
let tree_type = syn::parse2::< syn::Type >( code ).unwrap();
let got = typ::type_parameters( &tree_type, 0..=2 );
got.iter().for_each( | e | println!( "{}", qt!( #e ) ) );
/* print :
i8
i16
i32
*/
}
To add to your project
cargo add proc_macro_tools
Try out from the repository
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/macro_tools_trivial
cargo run
Dependencies
~345–800KB
~19K SLoC