Impl Id convert methods
This commit is contained in:
1 parent
97e301b0d6
commit
ba834ac9b1
3 files changed
+22
-10
No files matched your search
+12
@@ -68,3 +68,15 @@ macro_rules! id_impl {
|
||||
|
||||
id_impl!(u32, Id, INVALID_ID);
|
||||
id_impl!(u16, SmallId, INVALID_SMALL_ID);
|
||||
|
||||
impl From<SmallId> for Id {
|
||||
fn from(value: SmallId) -> Self {
|
||||
Self(value.0 as u32)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Id> for SmallId {
|
||||
fn from(value: Id) -> Self {
|
||||
Self(value.0 as u16)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user