proc_macro_tools

Crates.ioproc_macro_tools
lib.rsproc_macro_tools
version0.1.17
sourcesrc
created_at2022-01-15 16:10:28.042567
updated_at2022-07-18 03:13:42.556166
descriptionTools for writing procedural macroses.
homepagehttps://github.com/Wandalen/wTools/tree/master/module/rust/proc_macro_tools
repositoryhttps://github.com/Wandalen/wTools/tree/master/module/rust/proc_macro_tools
max_upload_size
id514395
size983,953
Wandalen (Wandalen)

documentation

https://docs.rs/proc_macro_tools

README

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
Commit count: 0

cargo fmt