diff options
Diffstat (limited to 'src/key.rs')
-rw-r--r-- | src/key.rs | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1,9 +1,12 @@ +/// Type representing a keypress. #[derive(Eq, PartialEq, Debug, Clone)] pub enum Key { String(String), Char(char), Bytes(Vec<u8>), Byte(u8), + /// The associated value will be a byte corresponding to the lowercase + /// letter for the control code. For instance, `^A` will be `Ctrl(b'a')`. Ctrl(u8), Meta(u8), Backspace, @@ -22,10 +25,13 @@ pub enum Key { Delete, PageUp, PageDown, + /// The associated value will be the number corresponding to the `F` key. + /// For instance, `F1` will be `F(1)`. F(u8), } impl Key { + /// Returns bytes generated by the given key press. pub fn into_bytes(self) -> Vec<u8> { use Key::*; match self { |