Suppose I want a global atomic. How do I implement that. I tried as below, and the unique ID is always the same.
const NEXT_UNIQUE_ID: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
fn main() {
println!("{:?} {:?} {:?}",
NEXT_UNIQUE_ID.fetch_add(1, std::sync::atomic::Ordering::SeqCst),
NEXT_UNIQUE_ID.fetch_add(1, std::sync::atomic::Ordering::SeqCst),
NEXT_UNIQUE_ID.fetch_add(1, std::sync::atomic::Ordering::SeqCst),
);
}