Crate randsym

source ·
Expand description

randsym

Creates unique identifiers for macros.

githubcrates-iodocs-rs

randsym generates unique identifiers using UUID. The identifies can be used simply to avoid two items with the same identifier, or they can be bound to names allowing the identifiers to be repeated.

The syntax is as follows:

  • /?/ - random identifier
  • /?@the_ident/ - random identifier bound to the name the_ident

Examples:

No binding

randsym::randsym! {
    fn /?/ () -> String {
        "I have a random name!".into()
    }
}

With binding

randsym::randsym! {
    fn /?@my_fn/ () -> String {
        "I have a random name!".into()
    }

    println!("{}", /?@my_fn/()); // "I have a random name!"
}

Macros