Module :: meta_tools

experimental rust-status docs.rs Open in Gitpod discord

Collection of general purpose meta tools.

Sample :: variadic constructor of collections

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

```rust use meta_tools::*;

let metamap = hmap! { 3 => 13 }; let mut stdmap = std::collections::HashMap::new(); stdmap.insert( 3, 13 ); asserteq!( metamap, stdmap ); ```

Sample :: 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.

```rust use metatools::*; foreach!( dbg, "a", "b", "c" );

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

To add to your project

sh cargo add meta_tools

Try out from the repository

sh git clone https://github.com/Wandalen/wTools cd wTools cd sample/rust/meta_tools_trivial cargo run