Make more structs derive PartialEq/Eq/Hash (#248)

Adds equality-related traits to VkClearRect, VkOffset2D, VkOffset3D,
VkRect2D and VkSurfaceFormatKHR. Fixes a typo preventing said traits
from being applied to VkExtent2D.
This commit is contained in:
Steve Wooster 2019-11-17 02:49:09 -08:00 committed by Maik Klein
parent 96490987d9
commit 54e7097dc7
2 changed files with 8 additions and 7 deletions

View file

@ -7926,7 +7926,7 @@ impl ::std::default::Default for BaseInStructure {
} }
} }
#[repr(C)] #[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>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkOffset2D.html>"]
pub struct Offset2D { pub struct Offset2D {
pub x: i32, pub x: i32,
@ -7973,7 +7973,7 @@ impl<'a> Offset2DBuilder<'a> {
} }
} }
#[repr(C)] #[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>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkOffset3D.html>"]
pub struct Offset3D { pub struct Offset3D {
pub x: i32, pub x: i32,
@ -8025,7 +8025,7 @@ impl<'a> Offset3DBuilder<'a> {
} }
} }
#[repr(C)] #[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>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkExtent2D.html>"]
pub struct Extent2D { pub struct Extent2D {
pub width: u32, pub width: u32,
@ -8191,7 +8191,7 @@ impl<'a> ViewportBuilder<'a> {
} }
} }
#[repr(C)] #[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>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkRect2D.html>"]
pub struct Rect2D { pub struct Rect2D {
pub offset: Offset2D, pub offset: Offset2D,
@ -8238,7 +8238,7 @@ impl<'a> Rect2DBuilder<'a> {
} }
} }
#[repr(C)] #[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>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkClearRect.html>"]
pub struct ClearRect { pub struct ClearRect {
pub rect: Rect2D, pub rect: Rect2D,
@ -19360,7 +19360,7 @@ impl<'a> StreamDescriptorSurfaceCreateInfoGGPBuilder<'a> {
} }
} }
#[repr(C)] #[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>"] #[doc = "<https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkSurfaceFormatKHR.html>"]
pub struct SurfaceFormatKHR { pub struct SurfaceFormatKHR {
pub format: Format, pub format: Format,

View file

@ -1762,7 +1762,8 @@ pub fn derive_setters(
/// require and add the missing derives yourself. /// require and add the missing derives yourself.
pub fn manual_derives(_struct: &vkxml::Struct) -> Tokens { pub fn manual_derives(_struct: &vkxml::Struct) -> Tokens {
match _struct.name.as_str() { match _struct.name.as_str() {
"VkExtent3D" | "VKExtent2D" => quote! {PartialEq, Eq, Hash,}, "VkClearRect" | "VkExtent2D" | "VkExtent3D" | "VkOffset2D" | "VkOffset3D" | "VkRect2D"
| "VkSurfaceFormatKHR" => quote! {PartialEq, Eq, Hash,},
_ => quote! {}, _ => quote! {},
} }
} }