no-std proc_macro_tools

Tools for writing procedural macroses

17 releases

0.1.17 Jul 18, 2022
0.1.16 Jul 17, 2022
0.1.7 Jun 29, 2022
0.1.4 May 31, 2022
0.1.0 Jan 15, 2022

#2477 in Development tools

Download history 295/week @ 2024-06-13 189/week @ 2024-06-20 310/week @ 2024-06-27 207/week @ 2024-07-04 304/week @ 2024-07-11 364/week @ 2024-07-18 232/week @ 2024-07-25 231/week @ 2024-08-01 260/week @ 2024-08-08 379/week @ 2024-08-15 211/week @ 2024-08-22 761/week @ 2024-08-29 543/week @ 2024-09-05 146/week @ 2024-09-12 105/week @ 2024-09-19 225/week @ 2024-09-26

1,045 downloads per month
Used in 32 crates (via woptions_meta)

MIT license

1MB
29K SLoC

Module :: proc_macro_tools

experimental rust-status docs.rs Open in Gitpod discord

Tools for writing procedural macroses.

Sample

#[ 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
  */
}

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 sample/rust/proc_macro_tools_trivial
cargo run

Dependencies

~1.5MB
~36K SLoC