2 releases

0.1.1 Aug 5, 2023
0.1.0 Jan 19, 2019

#281 in Procedural macros

Download history 4989/week @ 2024-08-09 5506/week @ 2024-08-16 5498/week @ 2024-08-23 5563/week @ 2024-08-30 4806/week @ 2024-09-06 4556/week @ 2024-09-13 4726/week @ 2024-09-20 3213/week @ 2024-09-27 5724/week @ 2024-10-04 4195/week @ 2024-10-11 4612/week @ 2024-10-18 4788/week @ 2024-10-25 5416/week @ 2024-11-01 4691/week @ 2024-11-08 5125/week @ 2024-11-15 5110/week @ 2024-11-22

21,352 downloads per month
Used in 77 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.5–1MB
~20K SLoC