From: Josh Simmons Date: Mon, 13 May 2024 21:27:20 +0000 (+0200) Subject: narcissus-core: Use derive for flags impls X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=b0e2c98ded62dd506de0fdac2fef360bc16c294b;p=josh%2Fnarcissus narcissus-core: Use derive for flags impls --- diff --git a/engine/narcissus-core/src/lib.rs b/engine/narcissus-core/src/lib.rs index 3372d6c..1bd371d 100644 --- a/engine/narcissus-core/src/lib.rs +++ b/engine/narcissus-core/src/lib.rs @@ -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 {