1use std::sync::atomic::{self, AtomicU64};
2
3pub struct Counter(AtomicU64);
4
5impl Counter {
6 pub const fn new() -> Counter {
7 Counter(AtomicU64::new(1))
8 }
9
10 pub fn next(&self) -> u64 {
11 self.0.fetch_add(1, atomic::Ordering::Relaxed)
12 }
13}