From 72cf4e577f4915572b08bebee6cff7f6dc9206c3 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sat, 3 Jun 2023 16:44:52 +0300 Subject: [PATCH] Add missing `Hash` impls on bitflags Some bitflags in public API lost their `Hash` implementations. Fixes: 31ebc5caf (Update `bitflags` to `2.0`) --- src/keyboard.rs | 4 ++-- src/platform/ios.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/keyboard.rs b/src/keyboard.rs index 94ce7de2..45a10c6d 100644 --- a/src/keyboard.rs +++ b/src/keyboard.rs @@ -1572,7 +1572,7 @@ bitflags! { /// Represents the current state of the keyboard modifiers /// /// Each flag represents a modifier and is set if this modifier is active. - #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] + #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct ModifiersState: u32 { /// The "shift" key. const SHIFT = 0b100; @@ -1623,7 +1623,7 @@ pub enum ModifiersKeyState { // to treat modifiers differently based on their position, which is required // on macOS due to their AltGr/Option situation. bitflags! { - #[derive(Default, Debug, Clone, Copy, PartialEq, Eq)] + #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)] pub(crate) struct ModifiersKeys: u8 { const LSHIFT = 0b0000_0001; const RSHIFT = 0b0000_0010; diff --git a/src/platform/ios.rs b/src/platform/ios.rs index 50abda5c..cd8605ed 100644 --- a/src/platform/ios.rs +++ b/src/platform/ios.rs @@ -253,7 +253,7 @@ impl MonitorHandleExtIOS for MonitorHandle { } /// Valid orientations for a particular [`Window`]. -#[derive(Clone, Copy, Debug, Default)] +#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum ValidOrientations { /// Excludes `PortraitUpsideDown` on iphone #[default] @@ -268,7 +268,7 @@ pub enum ValidOrientations { /// The device [idiom]. /// /// [idiom]: https://developer.apple.com/documentation/uikit/uidevice/1620037-userinterfaceidiom?language=objc -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum Idiom { Unspecified, @@ -287,7 +287,7 @@ bitflags! { /// The [edges] of a screen. /// /// [edges]: https://developer.apple.com/documentation/uikit/uirectedge?language=objc - #[derive(Default, Clone, Copy)] + #[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct ScreenEdge: u8 { const NONE = 0; const TOP = 1 << 0;