Skip to content

Commit

Permalink
Make more structs derive PartialEq/Eq/Hash (#248)
Browse files Browse the repository at this point in the history
Adds equality-related traits to VkClearRect, VkOffset2D, VkOffset3D,
VkRect2D and VkSurfaceFormatKHR. Fixes a typo preventing said traits
from being applied to VkExtent2D.
  • Loading branch information
swooster authored and MaikKlein committed Nov 17, 2019
1 parent 9649098 commit 54e7097
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
12 changes: 6 additions & 6 deletions ash/src/vk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7926,7 +7926,7 @@ impl ::std::default::Default for BaseInStructure {
}
}
#[repr(C)]
#[derive(Copy, Clone, Default, Debug)]
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkOffset2D.html>"]
pub struct Offset2D {
pub x: i32,
Expand Down Expand Up @@ -7973,7 +7973,7 @@ impl<'a> Offset2DBuilder<'a> {
}
}
#[repr(C)]
#[derive(Copy, Clone, Default, Debug)]
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkOffset3D.html>"]
pub struct Offset3D {
pub x: i32,
Expand Down Expand Up @@ -8025,7 +8025,7 @@ impl<'a> Offset3DBuilder<'a> {
}
}
#[repr(C)]
#[derive(Copy, Clone, Default, Debug)]
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkExtent2D.html>"]
pub struct Extent2D {
pub width: u32,
Expand Down Expand Up @@ -8191,7 +8191,7 @@ impl<'a> ViewportBuilder<'a> {
}
}
#[repr(C)]
#[derive(Copy, Clone, Default, Debug)]
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkRect2D.html>"]
pub struct Rect2D {
pub offset: Offset2D,
Expand Down Expand Up @@ -8238,7 +8238,7 @@ impl<'a> Rect2DBuilder<'a> {
}
}
#[repr(C)]
#[derive(Copy, Clone, Default, Debug)]
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkClearRect.html>"]
pub struct ClearRect {
pub rect: Rect2D,
Expand Down Expand Up @@ -19360,7 +19360,7 @@ impl<'a> StreamDescriptorSurfaceCreateInfoGGPBuilder<'a> {
}
}
#[repr(C)]
#[derive(Copy, Clone, Default, Debug)]
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq, Hash)]
#[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkSurfaceFormatKHR.html>"]
pub struct SurfaceFormatKHR {
pub format: Format,
Expand Down
3 changes: 2 additions & 1 deletion generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1762,7 +1762,8 @@ pub fn derive_setters(
/// require and add the missing derives yourself.
pub fn manual_derives(_struct: &vkxml::Struct) -> Tokens {
match _struct.name.as_str() {
"VkExtent3D" | "VKExtent2D" => quote! {PartialEq, Eq, Hash,},
"VkClearRect" | "VkExtent2D" | "VkExtent3D" | "VkOffset2D" | "VkOffset3D" | "VkRect2D"
| "VkSurfaceFormatKHR" => quote! {PartialEq, Eq, Hash,},
_ => quote! {},
}
}
Expand Down

0 comments on commit 54e7097

Please sign in to comment.