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