2 releases

0.1.1 Aug 5, 2023
0.1.0 Jan 19, 2019

#293 in Procedural macros

Download history 5214/week @ 2024-09-01 4976/week @ 2024-09-08 4298/week @ 2024-09-15 4549/week @ 2024-09-22 3580/week @ 2024-09-29 5282/week @ 2024-10-06 4328/week @ 2024-10-13 4889/week @ 2024-10-20 4614/week @ 2024-10-27 5330/week @ 2024-11-03 5029/week @ 2024-11-10 4925/week @ 2024-11-17 4718/week @ 2024-11-24 4221/week @ 2024-12-01 4150/week @ 2024-12-08 5326/week @ 2024-12-15

18,627 downloads per month
Used in 86 crates (12 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
~20K SLoC