use std::sync::atomic::{AtomicU32, Ordering};
pub struct TransactionCounter {
next: AtomicU32,
}
impl TransactionCounter {
pub fn new() -> Self {
Self {
next: AtomicU32::new(1),
}
}
pub fn next(&self) -> u32 {
self.next.fetch_add(1, Ordering::Relaxed)
}
}
impl Default for TransactionCounter {
fn default() -> Self {
Self::new()
}
}