17 breaking releases

0.23.0 Mar 22, 2024
0.21.0 Mar 16, 2024
0.3.0 Oct 21, 2023
0.1.2 May 25, 2022
0.1.1 Jan 15, 2022

#260 in Algorithms

Download history 67/week @ 2023-12-22 7/week @ 2023-12-29 59/week @ 2024-01-05 111/week @ 2024-01-12 46/week @ 2024-01-19 33/week @ 2024-01-26 39/week @ 2024-02-02 69/week @ 2024-02-09 109/week @ 2024-02-16 172/week @ 2024-02-23 685/week @ 2024-03-01 858/week @ 2024-03-08 936/week @ 2024-03-15 647/week @ 2024-03-22 177/week @ 2024-03-29 76/week @ 2024-04-05

1,966 downloads per month
Used in 52 crates (5 directly)

MIT license

89KB
2K SLoC

Module :: proc_macro_tools

experimentalrust-statusdocs.rsOpen in Gitpod discord

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

~285–730KB
~17K SLoC