1pub use self::{id::IndexId, kinds::*};
6
7pub(crate) mod id;
8
9pub(crate) mod kinds {
10 pub use self::atomic::AtomicId;
11
12 pub(crate) mod atomic;
13}
14
15pub trait Identifier: Copy + Eq + Ord + ToString {}
16
17pub trait IntoId {
18 type Id: Identifier;
19
20 fn into_id(self) -> Self::Id;
21}
22
23pub trait Identifiable {
24 type Id: Identifier;
25
26 fn id(&self) -> &Self::Id;
27
28 fn id_mut(&mut self) -> &mut Self::Id;
29}
30
31macro_rules! impl_identifier {
32 ($($t:ty),*) => {
33 $(
34 impl_identifier!(@loop $t);
35 )*
36 };
37 (@loop $t:ty) => {
38 impl Identifier for $t {}
39 };
40}
41
42impl_identifier! {
43 u8, u16, u32, u64, u128, usize, i8, i16, i32, i64, i128, isize
44}
45
46#[cfg(test)]
47mod tests {}