summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2026-03-15 23:07:32 +0100
committerThomas Voss <mail@thomasvoss.com> 2026-03-15 23:07:32 +0100
commit2a224be8bbd2c4c70c8b192132977e43aee69f4d (patch)
tree50553fda447cd43fe44fc80c1fd722a507a06757
parentbb4d0a8b49aed021fe8f13893d2e651923368c23 (diff)
Implement Into<usize> and From<usize> for IDs
-rw-r--r--oryxc/src/prelude.rs10
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;