chore: prepares for stage3/step1

This commit is contained in:
itsscb 2024-08-12 15:17:21 +02:00
parent ed37b8ccc8
commit 5411e39548
2 changed files with 12 additions and 0 deletions

View File

@ -1,6 +1,7 @@
mod db; mod db;
mod io_utils; mod io_utils;
mod models; mod models;
mod navigator;
mod ui; mod ui;
fn main() { fn main() {

View File

@ -1,3 +1,4 @@
use std::any::Any;
use std::rc::Rc; use std::rc::Rc;
use anyhow::anyhow; use anyhow::anyhow;
@ -13,6 +14,7 @@ use page_helpers::*;
pub trait Page { pub trait Page {
fn draw_page(&self) -> Result<()>; fn draw_page(&self) -> Result<()>;
fn handle_input(&self, input: &str) -> Result<Option<Action>>; fn handle_input(&self, input: &str) -> Result<Option<Action>>;
fn as_any(&self) -> &dyn Any;
} }
pub struct HomePage { pub struct HomePage {
@ -52,6 +54,9 @@ impl Page for HomePage {
), ),
} }
} }
fn as_any(&self) -> &dyn Any {
self
}
} }
pub struct EpicDetail { pub struct EpicDetail {
@ -126,6 +131,9 @@ impl Page for EpicDetail {
), ),
} }
} }
fn as_any(&self) -> &dyn Any {
self
}
} }
pub struct StoryDetail { pub struct StoryDetail {
@ -174,6 +182,9 @@ impl Page for StoryDetail {
_ => Ok(None), _ => Ok(None),
} }
} }
fn as_any(&self) -> &dyn Any {
self
}
} }
#[cfg(test)] #[cfg(test)]