We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
impl From<NamedKey> for Key
1 parent 7634834 commit 210d1a8Copy full SHA for 210d1a8
src/lib.rs
@@ -198,6 +198,12 @@ impl FromStr for Key {
198
}
199
200
201
+impl From<NamedKey> for Key {
202
+ fn from(value: NamedKey) -> Self {
203
+ Self::Named(value)
204
+ }
205
+}
206
+
207
impl Key {
208
/// Determine a *charCode* value for a key with a character value.
209
///
@@ -319,4 +325,9 @@ mod test {
319
325
assert!(!is_key_string("AA"));
320
326
assert!(!is_key_string(" "));
321
327
328
329
+ #[test]
330
+ fn into() {
331
+ assert_eq!(Key::Named(NamedKey::Enter), NamedKey::Enter.into());
332
322
333
0 commit comments