2 releases

0.1.1 Aug 5, 2023
0.1.0 Jan 19, 2019

#597 in Procedural macros

Download history 7453/week @ 2025-10-15 6899/week @ 2025-10-22 7975/week @ 2025-10-29 9522/week @ 2025-11-05 9641/week @ 2025-11-12 9381/week @ 2025-11-19 9542/week @ 2025-11-26 12768/week @ 2025-12-03 11976/week @ 2025-12-10 11198/week @ 2025-12-17 6814/week @ 2025-12-24 8218/week @ 2025-12-31 12565/week @ 2026-01-07 9160/week @ 2026-01-14 9497/week @ 2026-01-21 9299/week @ 2026-01-28

42,389 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

~345–770KB
~17K SLoC