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 过程宏

Download history 3475/week @ 2024-03-13 2699/week @ 2024-03-20 516/week @ 2024-03-27 693/week @ 2024-04-03 470/week @ 2024-04-10 324/week @ 2024-04-17 565/week @ 2024-04-24 769/week @ 2024-05-01 1311/week @ 2024-05-08 814/week @ 2024-05-15 405/week @ 2024-05-22 1249/week @ 2024-05-29 499/week @ 2024-06-05 314/week @ 2024-06-12 169/week @ 2024-06-19 140/week @ 2024-06-26

1,238 每月下载量
用于 32 个 crate(通过 woptions_meta

MIT 许可证

1MB
29K SLoC

模块 :: proc_macro_tools

experimental rust-status docs.rs Open in Gitpod discord

过程宏编写工具。

示例

#[ 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