better structure

This commit is contained in:
2025-06-28 15:02:45 +02:00
parent f401d4a995
commit f43be496c1
5 changed files with 36 additions and 26 deletions
+3 -3
View File
@@ -9,13 +9,13 @@ use crate::{
};
impl Event for KeyEvent {
fn as_any(self: Box<Self>) -> Box<dyn std::any::Any> {
fn as_any(&self) -> &dyn std::any::Any {
self
}
}
pub trait KeyPressEventHandler {
fn on_keypress(&mut self, events: &Arc<EventManager>, event: Box<KeyEvent>);
fn on_keypress(&mut self, events: &Arc<EventManager>, event: &KeyEvent);
}
pub struct KeyPressExtension;
@@ -26,7 +26,7 @@ impl Extension for KeyPressExtension {
crate::utils::clear().unwrap();
crate::utils::hide_cursor().unwrap();
events.on(|_, _: Box<Close>| {
events.on(|_, _: &Close| {
crossterm::terminal::disable_raw_mode().unwrap();
crate::utils::show_cursor().unwrap();
crate::utils::clear().unwrap();