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

@ -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 {