ombre 0.6.7

Shadowy game and graphics library for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! Internal identifiers.
use std::{num::NonZeroU64, sync::atomic::*};

/// Type for all identifiers.
pub type Id = NonZeroU64;

/// Get the next unique identifier.
pub fn next() -> Id {
    static NEXT: AtomicU64 = AtomicU64::new(1);

    let next = NEXT.fetch_add(1, Ordering::SeqCst);
    unsafe { NonZeroU64::new_unchecked(next) }
}