Update rust toolchain to 1.80 #180
@ -1,4 +1,4 @@
|
||||
use crossterm::event::{KeyEvent, MouseEvent};
|
||||
use crossterm::event::KeyEvent;
|
||||
use std::fmt;
|
||||
use std::sync::mpsc;
|
||||
|
||||
@ -36,8 +36,6 @@ impl From<mpsc::RecvError> for EventError {
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub enum Event {
|
||||
Key(KeyEvent),
|
||||
Mouse(MouseEvent),
|
||||
Resize(u16, u16),
|
||||
}
|
||||
|
||||
pub struct EventChannel {
|
||||
|
@ -41,8 +41,6 @@ impl<APP: IAppInteract> IEventHandler<APP> for EventHandler {
|
||||
fn handle_next_event(&self, mut app: APP) -> Result<APP, EventError> {
|
||||
match self.events.recv()? {
|
||||
Event::Key(key_event) => app = Self::handle_key_event(app, key_event),
|
||||
Event::Mouse(_) => {}
|
||||
Event::Resize(_, _) => {}
|
||||
};
|
||||
Ok(app)
|
||||
}
|
||||
|
@ -33,9 +33,7 @@ impl IEventListener for EventListener {
|
||||
Ok(event) => {
|
||||
if let Err(err) = match event {
|
||||
CrosstermEvent::Key(e) => self.events.send(Event::Key(e)),
|
||||
CrosstermEvent::Mouse(e) => self.events.send(Event::Mouse(e)),
|
||||
CrosstermEvent::Resize(w, h) => self.events.send(Event::Resize(w, h)),
|
||||
_ => unimplemented!(),
|
||||
_ => Ok(()),
|
||||
} {
|
||||
return err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user