1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use std::fmt::Display;
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ArchetypeId(u32);
impl From<u32> for ArchetypeId {
fn from(v: u32) -> Self {
Self(v)
}
}
impl ArchetypeId {
#[inline(always)]
pub const fn from_u32(v: u32) -> Self {
ArchetypeId(v)
}
#[inline(always)]
pub const fn into_u32(self) -> u32 {
self.0
}
}
impl Display for ArchetypeId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}
impl ArchetypeId {
#[inline(always)]
pub fn to_ne_bytes(self) -> [u8; 4] {
self.0.to_ne_bytes()
}
}