1 unstable release
0.1.0 | Jan 19, 2019 |
---|
#1504 in Procedural macros
9,104 downloads per month
Used in 36 crates
(4 directly)
7KB
gensym
Creates unique identifiers for macros using procedural macros and UUID
Examples
macro_rules! gen_fn {
($a:ty, $b:ty) => {
gensym::gensym!{ _gen_fn!{ $a, $b } }
};
}
macro_rules! _gen_fn {
($gensym:ident, $a:ty, $b:ty) => {
fn $gensym(a: $a, b: $b) {
unimplemented!()
}
};
}
mod test {
gen_fn!{ u64, u64 }
gen_fn!{ u64, u64 }
}
lib.rs
:
Creates unique identifiers for macros using procedural macros and UUID
Examples
macro_rules! gen_fn {
($a:ty, $b:ty) => {
gensym::gensym!{ _gen_fn!{ $a, $b } }
};
}
macro_rules! _gen_fn {
($gensym:ident, $a:ty, $b:ty) => {
fn $gensym(a: $a, b: $b) {
unimplemented!()
}
};
}
mod test {
gen_fn!{ u64, u64 }
gen_fn!{ u64, u64 }
}
Generate a unique identifier with a span of Span::call_site
and
insert it as the first argument to a macro call followed by a comma.
Dependencies
~2.5MB
~54K SLoC