Refactor to use view state
This commit is contained in:
17
src/widgets/views/mod.rs
Normal file
17
src/widgets/views/mod.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use std::any::Any;
|
||||
use crossterm::event::{Event, KeyEvent};
|
||||
|
||||
pub mod main_view;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum AppStatus {
|
||||
Running,
|
||||
Exiting,
|
||||
Input
|
||||
}
|
||||
|
||||
pub trait View {
|
||||
fn handle_input(&mut self, event: &Event) -> color_eyre::Result<()>;
|
||||
fn handle_key_input(&mut self, key: &KeyEvent) -> color_eyre::Result<()>;
|
||||
fn is_running(&self) -> bool;
|
||||
}
|
||||
Reference in New Issue
Block a user