diff options
Diffstat (limited to 'oryxc/src/prelude.rs')
| -rw-r--r-- | oryxc/src/prelude.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/oryxc/src/prelude.rs b/oryxc/src/prelude.rs index 389e160..0d1fc15 100644 --- a/oryxc/src/prelude.rs +++ b/oryxc/src/prelude.rs @@ -15,6 +15,16 @@ macro_rules! mkidtype { #[allow(dead_code)] pub const INVALID: Self = Self(u32::MAX); } + impl From<usize> for $name { + fn from(n: usize) -> Self { + return Self(n as u32); + } + } + impl Into<usize> for $name { + fn into(self) -> usize { + return self.0 as usize; + } + } }; } pub(crate) use mkidtype; |