]> git.nega.tv - josh/narcissus/commitdiff
narcissus-core: Use derive for flags impls
authorJosh Simmons <josh@nega.tv>
Mon, 13 May 2024 21:27:20 +0000 (23:27 +0200)
committerJosh Simmons <josh@nega.tv>
Mon, 13 May 2024 21:27:20 +0000 (23:27 +0200)
engine/narcissus-core/src/lib.rs

index 3372d6cb02872ce32098d4924a5ef03aafaddfba..1bd371db79998d8f674c0bc4acf9de79111838cd 100644 (file)
@@ -121,7 +121,8 @@ macro_rules! flags_def {
         flags_def!($name, u32);
     };
     ($name:ident, $ty:ty) => {
-        #[derive(PartialEq, Hash, Debug)]
+        #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default)]
+        #[repr(transparent)]
         pub struct $name($ty);
 
         impl $name {
@@ -151,22 +152,6 @@ macro_rules! flags_def {
             }
         }
 
-        impl Clone for $name {
-            fn clone(&self) -> Self {
-                *self
-            }
-        }
-
-        impl Copy for $name {}
-
-        impl Default for $name {
-            fn default() -> Self {
-                Self(0)
-            }
-        }
-
-        impl Eq for $name {}
-
         impl std::ops::BitOr for $name {
             type Output = Self;
             fn bitor(self, rhs: Self) -> Self::Output {