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:
parent
5be52c9753
commit
b049a4dc66
2 changed files with 2 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue