Crate meta_tools
source ·Expand description
Collection of general purpose meta tools.
§Module :: meta_tools
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
Modules§
- Dependencies.
- Exposed namespace of the module.
- Collection of general purpose meta tools.
- Orphan namespace of the module.
- Prelude to use essentials:
use my_module::prelude::*
. - Protected namespace of the module.
Macros§
- Internal impls1 macro. Don’t use.
- Literally just a BTreeMap literal with keys and values into’d.
- Unwrap braces of token tree and pass its content to the passed callback. If token tree in not braced then it passed to callback as is.
- Literally just a BTreeSet literal with values into’d.
- Get name of a function.
- Macro to rename function.
- Split functions.
- Split functions.
- Literally just a BinaryHeap literal with values into’d.
- Literally just a HashMap literal with keys and values into’d.
- Literally just a HashSet literal with values into’d.
- Macro which returns its input as is.
- Macros to put each function under a named macro to index every function in a class.
- Define implementation putting each function under a macro.
- Define implementation putting each function under a macro.
- Macros to put each function under a named macro to index every function in a class.
- Define implementation putting each function under a macro.
- Index of items.
- Literally just a LinkedList literal with values into’d.
- Protocol of modularity unifying interface of a module and introducing layers.
- Define implementation putting each function under a macro and adding attribute
#[ test ]
. - Define implementation putting each function under a macro and adding attribute
#[ test ]
. - Index of items.
- Literally just a VecDeque literal with values into’d.