1//! Identifier for a Node
2//!
3//!
4use core::sync::atomic::{AtomicUsize, Ordering};
5
6/// Internal node id.
7pub(crate) type NodeId = usize;
8
9#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
10#[cfg_attr(not(any(feature = "std", feature = "alloc")), derive(hash32_derive::Hash32))]
11pub(crate) struct Id(usize);
12
13pub(crate) struct Allocator {
14 new_id: AtomicUsize,
15}
16
17impl Allocator {
18 pub const fn new() -> Self {
19 Self { new_id: AtomicUsize::new(0) }
20 }
21
22 pub fn allocate(&self) -> Id {
23 Id(self.new_id.fetch_add(1, Ordering::Relaxed))
24 }
25
26 pub fn free(&self, _ids: &[Id]) {}
27}