Skip to content
Snippets Groups Projects
Commit b23ec6ee authored by Gav Wood's avatar Gav Wood
Browse files

Nice macros.

parent 3a1d829b
No related merge requests found
......@@ -5,3 +5,31 @@ pub use uint::*;
pub use bytes::*;
pub use vector::*;
pub use sha3::*;
#[macro_export]
macro_rules! map {
( $( $x:expr => $y:expr ),* ) => {
vec![ $( ($x, $y) ),* ].into_iter().collect::<BTreeMap<_, _>>()
}
}
#[macro_export]
macro_rules! mapx {
( $( $x:expr => $y:expr ),* ) => {
vec![ $( ( From::from($x), From::from($y) ) ),* ].into_iter().collect::<BTreeMap<_, _>>()
}
}
#[macro_export]
macro_rules! x {
( $x:expr ) => {
From::from($x)
}
}
#[macro_export]
macro_rules! xx {
( $x:expr ) => {
From::from(From::from($x))
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment