Skip to content

Commit

Permalink
Implement PartialOrd/Ord for KeyCode/NativeKeyCode
Browse files Browse the repository at this point in the history
  • Loading branch information
StarStarJ authored Jul 1, 2023
1 parent 6178ace commit 81fd394
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre

# Unreleased

- Implement `PartialOrd` and `Ord` for `KeyCode` and `NativeKeyCode`.

# 0.29.0-beta.0

- On Web, allow event loops to be recreated with `spawn`.
Expand Down
4 changes: 2 additions & 2 deletions src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ use smol_str::SmolStr;
///
/// - Correctly match key press and release events.
/// - On non-web platforms, support assigning keybinds to virtually any key through a UI.
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum NativeKeyCode {
Unidentified,
Expand Down Expand Up @@ -196,7 +196,7 @@ impl std::fmt::Debug for NativeKey {
///
/// [`KeyboardEvent.code`]: https://w3c.github.io/uievents-code/#code-value-tables
#[non_exhaustive]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
pub enum KeyCode {
/// This variant is used when the key cannot be translated to any other variant.
Expand Down

0 comments on commit 81fd394

Please sign in to comment.