From 3d63f7fa3326f2a1dd0cfa12d183742e0b33a17a Mon Sep 17 00:00:00 2001 From: Tim Oram Date: Thu, 15 Feb 2024 10:08:23 -0330 Subject: Cleanup crossterm declarations --- src/input.rs | 2 +- src/input/event.rs | 4 +--- src/input/event_provider.rs | 6 ++++-- src/input/key_event.rs | 2 +- src/input/thread.rs | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/input.rs b/src/input.rs index a4e8d96..0111011 100644 --- a/src/input.rs +++ b/src/input.rs @@ -17,7 +17,7 @@ mod key_event; mod standard_event; mod thread; -pub(crate) use crossterm::event::{KeyCode, KeyModifiers, MouseEvent, MouseEventKind}; +pub(crate) use crossterm::event::{KeyCode, KeyEventKind, KeyModifiers, MouseEvent, MouseEventKind}; pub(crate) use self::{ event::Event, diff --git a/src/input/event.rs b/src/input/event.rs index f96f817..23dbc2f 100644 --- a/src/input/event.rs +++ b/src/input/event.rs @@ -1,6 +1,4 @@ -use crossterm::event::{KeyCode, MouseEvent}; - -use crate::input::{KeyEvent, StandardEvent}; +use crate::input::{KeyCode, KeyEvent, MouseEvent, StandardEvent}; /// An event, either from an input device, system change or action event. #[derive(Debug, PartialOrd, PartialEq, Eq, Clone, Copy)] diff --git a/src/input/event_provider.rs b/src/input/event_provider.rs index 477dbba..d6879cb 100644 --- a/src/input/event_provider.rs +++ b/src/input/event_provider.rs @@ -3,11 +3,13 @@ use std::time::Duration; use anyhow::{anyhow, Result}; #[cfg(not(test))] use crossterm::event::{poll, read}; -use crossterm::event::{Event, KeyEvent, KeyEventKind, MouseEvent, MouseEventKind}; +use crossterm::event::{Event, KeyEvent}; #[cfg(test)] use read_event_mocks::{poll, read}; -/// Function that returns a event +use crate::input::{KeyEventKind, MouseEvent, MouseEventKind}; + +/// Function that returns an event pub(crate) trait EventReaderFn: Fn() -> Result> + Send + Sync + 'static {} impl Result> + Send + Sync + 'static> EventReaderFn for FN {} diff --git a/src/input/key_event.rs b/src/input/key_event.rs index b88fcc4..a947e20 100644 --- a/src/input/key_event.rs +++ b/src/input/key_event.rs @@ -1,4 +1,4 @@ -use crossterm::event::{KeyCode, KeyModifiers}; +use crate::input::{KeyCode, KeyModifiers}; /// Represents a key event. #[derive(Debug, PartialOrd, PartialEq, Eq, Clone, Copy)] diff --git a/src/input/thread.rs b/src/input/thread.rs index b9897de..657ea88 100644 --- a/src/input/thread.rs +++ b/src/input/thread.rs @@ -91,11 +91,10 @@ where EventProvider: EventReaderFn #[cfg(test)] mod tests { use anyhow::anyhow; - use crossterm::event::{KeyCode, KeyModifiers}; use super::*; use crate::{ - input::KeyEvent, + input::{KeyCode, KeyEvent, KeyModifiers}, runtime::Status, test_helpers::{create_event_reader, testers}, }; -- cgit v1.2.3