2 releases

0.1.1 Aug 5, 2023
0.1.0 Jan 19, 2019

#327 in Procedural macros

Download history 4788/week @ 2024-10-25 5416/week @ 2024-11-01 4691/week @ 2024-11-08 5048/week @ 2024-11-15 4910/week @ 2024-11-22 4151/week @ 2024-11-29 4030/week @ 2024-12-06 4813/week @ 2024-12-13 2830/week @ 2024-12-20 1728/week @ 2024-12-27 3156/week @ 2025-01-03 4064/week @ 2025-01-10 4379/week @ 2025-01-17 3912/week @ 2025-01-24 6218/week @ 2025-01-31 5154/week @ 2025-02-07

20,622 downloads per month
Used in 106 crates (14 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.4–0.9MB
~19K SLoC