2 releases

0.1.1 Aug 5, 2023
0.1.0 Jan 19, 2019

#253 in Procedural macros

Download history 4821/week @ 2024-04-22 6261/week @ 2024-04-29 4072/week @ 2024-05-06 5194/week @ 2024-05-13 6553/week @ 2024-05-20 5190/week @ 2024-05-27 5946/week @ 2024-06-03 5415/week @ 2024-06-10 5916/week @ 2024-06-17 5048/week @ 2024-06-24 4494/week @ 2024-07-01 6990/week @ 2024-07-08 7250/week @ 2024-07-15 6642/week @ 2024-07-22 6976/week @ 2024-07-29 5553/week @ 2024-08-05

26,846 downloads per month
Used in 70 crates (9 directly)

MIT/Apache

8KB

Crates.io Rust Documentation

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
~21K SLoC