2 releases

0.1.1 Aug 5, 2023
0.1.0 Jan 19, 2019

#604 in Procedural macros

Download history 8218/week @ 2025-12-31 12565/week @ 2026-01-07 9160/week @ 2026-01-14 9497/week @ 2026-01-21 9224/week @ 2026-01-28 9278/week @ 2026-02-04 11514/week @ 2026-02-11 15361/week @ 2026-02-18 15396/week @ 2026-02-25 19116/week @ 2026-03-04 16814/week @ 2026-03-11 14906/week @ 2026-03-18 11052/week @ 2026-03-25 11172/week @ 2026-04-01 12582/week @ 2026-04-08 15898/week @ 2026-04-15

53,395 downloads per month
Used in 141 crates (13 directly)

MIT/Apache

8KB

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.


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 }
}

Dependencies

~325–730KB
~16K SLoC