Skip to main content

squid_n_core/
ids.rs

1macro_rules! id_newtype {
2    ($name:ident) => {
3        #[derive(
4            Clone,
5            Copy,
6            PartialEq,
7            Eq,
8            Hash,
9            PartialOrd,
10            Ord,
11            Debug,
12            serde::Serialize,
13            serde::Deserialize,
14        )]
15        pub struct $name(pub u32);
16        impl $name {
17            pub fn index(self) -> usize {
18                self.0 as usize
19            }
20        }
21    };
22}
23
24id_newtype!(NodeId);
25id_newtype!(ElemId);
26id_newtype!(StoryId);
27id_newtype!(FloorRegionId);
28id_newtype!(SectionId);
29id_newtype!(MaterialId);
30id_newtype!(LoadCaseId);
31id_newtype!(VibrationCaseId);
32id_newtype!(LumpedVibrationCaseId);
33id_newtype!(SlabId);
34id_newtype!(WallRegionId);
35id_newtype!(WallPlateId);