(key: KeyEvent)
| 24 | |
| 25 | impl Event { |
| 26 | fn from_key_event(key: KeyEvent) -> Self { |
| 27 | use crossterm::event::KeyCode as TermKeyCode; |
| 28 | let code = match key.code { |
| 29 | TermKeyCode::Char('q') => KeyCode::Q, |
| 30 | TermKeyCode::Up => KeyCode::Up, |
| 31 | TermKeyCode::Down => KeyCode::Down, |
| 32 | TermKeyCode::Left => KeyCode::Left, |
| 33 | TermKeyCode::Right => KeyCode::Right, |
| 34 | _ => return Event::KeyPress(KeyCode::Q), |
| 35 | }; |
| 36 | Event::KeyPress(code) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | #[derive(Clone, Copy, Debug)] |
nothing calls this directly
no outgoing calls
no test coverage detected