Skip to content

Commit

Permalink
Encapsulated key in own type
Browse files Browse the repository at this point in the history
  • Loading branch information
fritzrehde committed Jan 11, 2023
1 parent 4229cb1 commit 0f73c2a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/config/keybindings/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@ use crossterm::event::{KeyCode, KeyEvent, KeyModifiers};
use std::str::FromStr;

#[derive(Hash, Eq, PartialEq)]
pub struct Key {
event: KeyEvent,
}
pub struct Key(KeyEvent);

impl Key {
pub fn new(event: KeyEvent) -> Self {
Self { event }
Self(event)
}
}

Expand All @@ -24,7 +22,7 @@ impl FromStr for Key {
}
None => parse_code(s)?,
};
Ok(Key { event })
Ok(Key(event))
}
}

Expand Down

0 comments on commit 0f73c2a

Please sign in to comment.