scsys_core/id/
mod.rs

1/*
2    Appellation: ids <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5//! # Identity
6//!
7//! The identity module provides a set of traits and types for generating unique identifiers.
8#[doc(inline)]
9pub use self::{identifier::*, kinds::prelude::*, traits::*};
10
11pub(crate) mod identifier;
12pub(crate) mod traits;
13
14pub mod kinds {
15    #[doc(inline)]
16    pub use self::indexed::IndexId;
17
18    pub mod indexed;
19
20    pub(crate) mod prelude {
21        #[doc(inline)]
22        pub use super::indexed::IndexId;
23    }
24}
25
26pub(crate) mod prelude {
27    pub use super::identifier::Id;
28    pub use super::kinds::prelude::*;
29    pub use super::traits::*;
30}
31
32#[cfg(test)]
33mod tests {
34    use super::Id;
35    use super::traits::Identity;
36
37    #[test]
38    fn test_id() {
39        let id = 0usize.get();
40        assert_eq!(id, &0);
41        let atomic = Id::atomic();
42        let aid = Id::<usize>::get(&atomic);
43        assert_ne!(*aid, *id);
44    }
45}