1use std::sync::atomic::{AtomicUsize, Ordering::SeqCst};
4
5#[derive(Debug, PartialEq, Eq, PartialOrd, Ord)]
6#[repr(transparent)]
7pub struct EngineId {
9 id: usize,
10}
11
12impl EngineId {
13 pub fn id(&self) -> String {
15 format!("{}", &self.id)
16 }
17}
18
19impl Clone for EngineId {
20 fn clone(&self) -> Self {
21 Self::default()
22 }
23}
24
25impl Default for EngineId {
26 fn default() -> Self {
27 static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
28 Self { id: NEXT_ID.fetch_add(1, SeqCst) }
29 }
30}