2 releases
0.1.1 | Aug 5, 2023 |
---|---|
0.1.0 | Jan 19, 2019 |
#281 in Procedural macros
21,352 downloads per month
Used in 77 crates
(12 directly)
8KB
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
~0.5–1MB
~20K SLoC