Crates.io | meta_tools_min |
lib.rs | meta_tools_min |
version | 0.2.13 |
source | src |
created_at | 2022-05-26 22:13:17.256404 |
updated_at | 2022-07-18 20:29:11.511812 |
description | Collection of general purpose meta tools. Minimal Set. |
homepage | https://github.com/Wandalen/wTools/tree/master/module/rust/meta_tools_min |
repository | https://github.com/Wandalen/wTools/tree/master/module/rust/meta_tools_min |
max_upload_size | |
id | 594528 |
size | 979,542 |
Collection of general purpose meta tools.
Among other useful meta tools the module aggregates variadtic constructors of collections. For example macro hmap!
for constructing a hash map.
#[ cfg( feature = "collection_make" ) ]
{
use meta_tools_min::*;
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.
#[ cfg( feature = "for_each" ) ]
{
use meta_tools_min::*;
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 sample/rust/meta_tools_trivial
cargo run