1 unstable release

0.1.0 Jan 19, 2019

#1504 in Procedural macros

Download history 2057/week @ 2023-01-24 2119/week @ 2023-01-31 2027/week @ 2023-02-07 1935/week @ 2023-02-14 2331/week @ 2023-02-21 1485/week @ 2023-02-28 957/week @ 2023-03-07 1091/week @ 2023-03-14 959/week @ 2023-03-21 1505/week @ 2023-03-28 1576/week @ 2023-04-04 1674/week @ 2023-04-11 1654/week @ 2023-04-18 2162/week @ 2023-04-25 2128/week @ 2023-05-02 2645/week @ 2023-05-09

9,104 downloads per month
Used in 36 crates (4 directly)

MIT/Apache

7KB

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

~2.5MB
~54K SLoC