Crates.io | meta_tools |
lib.rs | meta_tools |
version | 0.12.0 |
source | src |
created_at | 2022-01-10 14:47:29.247941 |
updated_at | 2024-10-30 21:04:47.623589 |
description | Collection of general purpose meta tools. |
homepage | https://github.com/Wandalen/wTools/tree/master/module/core/meta_tools |
repository | https://github.com/Wandalen/wTools/tree/master/module/core/meta_tools |
max_upload_size | |
id | 511440 |
size | 20,053 |
Collection of general purpose meta tools.
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 );
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" );
cargo add meta_tools
git clone https://github.com/Wandalen/wTools
cd wTools
cd examples/meta_tools_trivial
cargo run