rpg_compiler/uid/mod.rs
1static mut UUID_COUNTER: usize = 0;
2
3/// Generates a uid, which is us just a counter.
4///
5/// Will not return a uid of 0, because the counter is incremented before it is returned.
6/// Also means the max value cannot be returned as this function will panic due to trying to
7/// increment with overflow.
8pub fn generate_uid() -> usize {
9 unsafe {
10 UUID_COUNTER += 1;
11 UUID_COUNTER
12 }
13}