Add ordering traits to VirtualKeyCode (#713)

Motivation:
This allows VirtualKeyCode variants to be stored in a BTreeSet.
Unlike HashSets, BTreeSets implement Ord and Hash, allowing them to be
keys in a {Hash|BTree}Maps. This is nice, e.g. when implementing
keyboard shortcuts functionality, which maps a set of pressed keys to
some action.
This commit is contained in:
Oskar Gustafsson 2018-11-19 22:59:04 +01:00 committed by Francesca Plebani
parent 5be52c9753
commit b049a4dc66
2 changed files with 2 additions and 1 deletions

View file

@ -6,6 +6,7 @@
- On Windows, fix issue where resizing or moving window combined with grabbing the cursor would freeze program.
- On Windows, fix issue where resizing or moving window would eat `Awakened` events.
- On X11, fixed a segfault when using virtual monitors with XRandR.
- Derive `Ord` and `PartialOrd` for `VirtualKeyCode` enum.
# Version 0.18.0 (2018-11-07)

View file

@ -253,7 +253,7 @@ pub enum MouseScrollDelta {
}
/// Symbolic name for a keyboard key.
#[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)]
#[derive(Debug, Hash, Ord, PartialOrd, PartialEq, Eq, Clone, Copy)]
#[repr(u32)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum VirtualKeyCode {