17 个版本
0.1.17 | 2022年7月18日 |
---|---|
0.1.16 | 2022年7月17日 |
0.1.7 | 2022年6月29日 |
0.1.4 | 2022年5月31日 |
0.1.0 | 2022年1月15日 |
#1038 in 过程宏
1,238 每月下载量
用于 32 个 crate(通过 woptions_meta)
1MB
29K SLoC
模块 :: proc_macro_tools
过程宏编写工具。
示例
#[ cfg( feature = "use_std" ) ]
{
use proc_macro_tools::*;
let code = qt!( core::option::Option< i8, i16, i32, i64 > );
let tree_type = syn::parse2::< syn::Type >( code ).unwrap();
let got = type_parameters( &tree_type, 0..=2 );
got.iter().for_each( | e | println!( "{}", qt!( #e ) ) );
/* print :
i8
i16
i32
*/
}
添加到您的项目中
cargo add proc_macro_tools
从仓库尝试
git clone https://github.com/Wandalen/wTools
cd wTools
cd sample/rust/proc_macro_tools_trivial
cargo run
依赖项
~1.5MB
~35K SLoC