diff --git a/crates/bevy_math/src/rects/irect.rs b/crates/bevy_math/src/rects/irect.rs index 05498cea1554e..b8a1b21a792a4 100644 --- a/crates/bevy_math/src/rects/irect.rs +++ b/crates/bevy_math/src/rects/irect.rs @@ -9,7 +9,7 @@ use crate::{IVec2, Rect, URect}; /// methods instead, which will ensure this invariant is met, unless you already have /// the minimum and maximum corners. #[repr(C)] -#[derive(Default, Clone, Copy, Debug, PartialEq)] +#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] pub struct IRect { /// The minimum corner point of the rect. diff --git a/crates/bevy_math/src/rects/urect.rs b/crates/bevy_math/src/rects/urect.rs index 1f04882d16c35..fb74a6183e9b0 100644 --- a/crates/bevy_math/src/rects/urect.rs +++ b/crates/bevy_math/src/rects/urect.rs @@ -9,7 +9,7 @@ use crate::{IRect, Rect, UVec2}; /// methods instead, which will ensure this invariant is met, unless you already have /// the minimum and maximum corners. #[repr(C)] -#[derive(Default, Clone, Copy, Debug, PartialEq)] +#[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Hash)] #[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))] pub struct URect { /// The minimum corner point of the rect. diff --git a/crates/bevy_reflect/src/impls/rect.rs b/crates/bevy_reflect/src/impls/rect.rs index b215a58599d20..8f882eab27cc6 100644 --- a/crates/bevy_reflect/src/impls/rect.rs +++ b/crates/bevy_reflect/src/impls/rect.rs @@ -1,9 +1,18 @@ use crate as bevy_reflect; use crate::prelude::ReflectDefault; use crate::{ReflectDeserialize, ReflectSerialize}; -use bevy_math::{Rect, Vec2}; +use bevy_math::{IRect, IVec2, Rect, URect, UVec2, Vec2}; use bevy_reflect_derive::impl_reflect_struct; +impl_reflect_struct!( + #[reflect(Debug, PartialEq, Hash, Serialize, Deserialize, Default)] + #[type_path = "bevy_math"] + struct IRect { + min: IVec2, + max: IVec2, + } +); + impl_reflect_struct!( #[reflect(Debug, PartialEq, Serialize, Deserialize, Default)] #[type_path = "bevy_math"] @@ -12,3 +21,12 @@ impl_reflect_struct!( max: Vec2, } ); + +impl_reflect_struct!( + #[reflect(Debug, PartialEq, Hash, Serialize, Deserialize, Default)] + #[type_path = "bevy_math"] + struct URect { + min: UVec2, + max: UVec2, + } +);