compose-idents 0.3.0

A Rust macro for generating new identifiers (names of variables, functions, traits, etc) by concatenating one or more arbitrary parts and applying other manipulations.
Documentation
1
2
3
4
5
6
7
8
9
10
11
use std::sync::atomic::AtomicU64;

static mut SEED_SEQ: AtomicU64 = AtomicU64::new(0);

/// Generates a unique ID for each invocation.
pub fn next_unique_id() -> u64 {
    #[allow(static_mut_refs)]
    unsafe {
        SEED_SEQ.fetch_add(1, std::sync::atomic::Ordering::SeqCst)
    }
}