feat: derive Copy for Accelerator

This commit is contained in:
amrbashir 2022-12-12 23:35:41 +02:00
parent e587421c64
commit e80c113d8c
No known key found for this signature in database
GPG key ID: BBD7A47A2003FF33
3 changed files with 7 additions and 2 deletions

5
.changes/accel-copy.md Normal file
View file

@ -0,0 +1,5 @@
---
"muda": "patch"
---
Derive `Copy` for `Accelerator` type.

View file

@ -33,7 +33,7 @@ use std::{borrow::Borrow, hash::Hash, str::FromStr};
/// A keyboard shortcut that consists of an optional combination
/// of modifier keys (provided by [`Modifiers`](crate::accelerator::Modifiers)) and
/// one key ([`Code`](crate::accelerator::Code)).
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Copy)]
pub struct Accelerator {
pub(crate) mods: Modifiers,
pub(crate) key: Code,

View file

@ -162,7 +162,7 @@ fn key_to_vk(key: &Code) -> VIRTUAL_KEY {
Code::MediaPlayPause => VK_MEDIA_PLAY_PAUSE,
Code::LaunchMail => VK_LAUNCH_MAIL,
Code::Convert => VK_CONVERT,
key => panic!("Unsupported modifier: {}", key),
key => panic!("Unsupported key: {}", key),
}
}