event: derive Hash
This commit is contained in:
parent
2e775d270f
commit
cc112415c5
@ -3,7 +3,7 @@ use ffi::*;
|
||||
use {Event};
|
||||
use super::{Kind, Code};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum Absolute {
|
||||
Position(Position),
|
||||
Wheel(Wheel),
|
||||
@ -39,7 +39,7 @@ impl Code for Absolute {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(PositionVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(PositionVariants))]
|
||||
pub enum Position {
|
||||
X,
|
||||
Y,
|
||||
@ -78,7 +78,7 @@ impl Code for Position {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(WheelVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(WheelVariants))]
|
||||
pub enum Wheel {
|
||||
Throttle,
|
||||
Rudder,
|
||||
@ -115,7 +115,7 @@ impl Code for Wheel {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(HatVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(HatVariants))]
|
||||
pub enum Hat {
|
||||
X0,
|
||||
Y0,
|
||||
@ -158,7 +158,7 @@ impl Code for Hat {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(DigiVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(DigiVariants))]
|
||||
pub enum Digi {
|
||||
Pressure,
|
||||
Distance,
|
||||
@ -197,7 +197,7 @@ impl Code for Digi {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(MultiVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(MultiVariants))]
|
||||
pub enum Multi {
|
||||
Slot,
|
||||
TouchMajor,
|
||||
|
@ -3,7 +3,7 @@ use ffi::*;
|
||||
use {Event};
|
||||
use super::{Kind, Code, Press, Release};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum Controller {
|
||||
All,
|
||||
Misc(Misc),
|
||||
@ -49,7 +49,7 @@ impl Code for Controller {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(MiscVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(MiscVariants))]
|
||||
pub enum Misc {
|
||||
_0,
|
||||
_1,
|
||||
@ -94,7 +94,7 @@ impl Code for Misc {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(MouseVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(MouseVariants))]
|
||||
pub enum Mouse {
|
||||
Left,
|
||||
Right,
|
||||
@ -129,7 +129,7 @@ impl Code for Mouse {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(JoyStickVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(JoyStickVariants))]
|
||||
pub enum JoyStick {
|
||||
Trigger,
|
||||
Thumb,
|
||||
@ -183,7 +183,7 @@ impl Code for JoyStick {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(GamePadVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(GamePadVariants))]
|
||||
pub enum GamePad {
|
||||
South,
|
||||
A,
|
||||
@ -249,7 +249,7 @@ impl Code for GamePad {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(DigiVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(DigiVariants))]
|
||||
pub enum Digi {
|
||||
Pen,
|
||||
Rubber,
|
||||
@ -307,7 +307,7 @@ impl Code for Digi {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(WheelVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(WheelVariants))]
|
||||
pub enum Wheel {
|
||||
GearDown,
|
||||
GearUp,
|
||||
@ -339,7 +339,7 @@ impl Code for Wheel {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(DPadVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(DPadVariants))]
|
||||
pub enum DPad {
|
||||
Up,
|
||||
Down,
|
||||
@ -375,7 +375,7 @@ impl Code for DPad {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(TriggerHappyVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(TriggerHappyVariants))]
|
||||
pub enum TriggerHappy {
|
||||
_1,
|
||||
_2,
|
||||
|
@ -3,7 +3,7 @@ use ffi::*;
|
||||
use {Event};
|
||||
use super::{Kind, Code, Press, Release};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum Keyboard {
|
||||
All,
|
||||
Key(Key),
|
||||
@ -53,7 +53,7 @@ impl Code for Keyboard {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(KeyVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(KeyVariants))]
|
||||
pub enum Key {
|
||||
Reserved,
|
||||
Esc,
|
||||
@ -285,7 +285,7 @@ impl Code for Key {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(KeyPadVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(KeyPadVariants))]
|
||||
pub enum KeyPad {
|
||||
Asterisk,
|
||||
_7,
|
||||
@ -357,7 +357,7 @@ impl Code for KeyPad {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(MiscVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(MiscVariants))]
|
||||
pub enum Misc {
|
||||
ZenkakuHankaku,
|
||||
ND102,
|
||||
@ -849,7 +849,7 @@ impl Code for Misc {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(FunctionVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(FunctionVariants))]
|
||||
pub enum Function {
|
||||
Press,
|
||||
Esc,
|
||||
@ -919,7 +919,7 @@ impl Code for Function {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(BrailleVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(BrailleVariants))]
|
||||
pub enum Braille {
|
||||
Dot1,
|
||||
Dot2,
|
||||
@ -967,7 +967,7 @@ impl Code for Braille {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(NumericVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(NumericVariants))]
|
||||
pub enum Numeric {
|
||||
_0,
|
||||
_1,
|
||||
@ -1027,7 +1027,7 @@ impl Code for Numeric {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(TouchPadVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(TouchPadVariants))]
|
||||
pub enum TouchPad {
|
||||
Toggle,
|
||||
On,
|
||||
@ -1061,7 +1061,7 @@ impl Code for TouchPad {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(CameraVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(CameraVariants))]
|
||||
pub enum Camera {
|
||||
ZoomIn,
|
||||
ZoomOut,
|
||||
@ -1103,7 +1103,7 @@ impl Code for Camera {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(AttendantVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(AttendantVariants))]
|
||||
pub enum Attendant {
|
||||
On,
|
||||
Off,
|
||||
@ -1137,7 +1137,7 @@ impl Code for Attendant {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(InputAssistVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(InputAssistVariants))]
|
||||
pub enum InputAssist {
|
||||
Prev,
|
||||
Next,
|
||||
|
@ -22,7 +22,7 @@ pub trait Release: Kind + Code { }
|
||||
pub trait Position: Kind + Code { }
|
||||
|
||||
/// All supported events.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum Event {
|
||||
All,
|
||||
|
||||
|
@ -3,7 +3,7 @@ use ffi::*;
|
||||
use {Event};
|
||||
use super::{Kind, Code};
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum Relative {
|
||||
Position(Position),
|
||||
Wheel(Wheel),
|
||||
@ -33,7 +33,7 @@ impl Code for Relative {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(PositionVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(PositionVariants))]
|
||||
pub enum Position {
|
||||
X,
|
||||
Y,
|
||||
@ -72,7 +72,7 @@ impl Code for Position {
|
||||
}
|
||||
|
||||
custom_derive! {
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug, IterVariants(WheelVariants))]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, IterVariants(WheelVariants))]
|
||||
pub enum Wheel {
|
||||
Horizontal,
|
||||
Dial,
|
||||
|
Loading…
Reference in New Issue
Block a user