28 releases (9 breaking)

new 0.10.0 May 11, 2024
0.9.0 Mar 16, 2024
0.8.0 Mar 16, 2024
0.5.0 Oct 28, 2023
0.1.0 Jan 10, 2022

#500 in Development tools

Download history 168/week @ 2024-01-22 178/week @ 2024-01-29 204/week @ 2024-02-05 367/week @ 2024-02-12 402/week @ 2024-02-19 585/week @ 2024-02-26 512/week @ 2024-03-04 3188/week @ 2024-03-11 3432/week @ 2024-03-18 634/week @ 2024-03-25 921/week @ 2024-04-01 441/week @ 2024-04-08 429/week @ 2024-04-15 678/week @ 2024-04-22 568/week @ 2024-04-29 1155/week @ 2024-05-06

2,871 downloads per month
Used in 82 crates (8 directly)

MIT license

64KB
1K SLoC

Module :: meta_tools

experimental rust-status docs.rs Open in Gitpod discord

Collection of general purpose meta tools.

Basic use-case :: variadic constructor of collections

Among other useful meta tools the module aggregates variadic constructors of collections. For example macro hmap! for constructing a hash map.

use meta_tools::*;

let meta_map = hmap! { 3 => 13 };
let mut std_map = std::collections::HashMap::new();
std_map.insert( 3, 13 );
assert_eq!( meta_map, std_map );

Basic Use Case :: function-style call

Apply a macro for each element of a list.

Macro for_each may be called either in function-style way or in map-style way. Pass name of macro to apply to elements as the first arguments and elements after the macro name. Use comma as delimiter.

use meta_tools::*;
for_each!( dbg, "a", "b", "c" );

// generates
dbg!( "a" );
dbg!( "b" );
dbg!( "c" );

To add to your project

cargo add meta_tools

Try out from the repository

git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/meta_tools_trivial
cargo run

Dependencies

~1.6–2.2MB
~43K SLoC