pub mod input;
pub mod literal;
use crate::coordinator::Coordinator;
use crate::layout::LayoutAccessor;
use crate::Result;
use termion::event::Key;
#[derive(Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)]
pub struct ElementId {
step_index: usize,
element_index: usize,
}
impl ElementId {
pub(crate) fn new(step_index: usize, element_index: usize) -> Self {
Self {
step_index,
element_index,
}
}
}
pub trait Element {
fn set_id(&mut self, element_id: ElementId);
fn render(&mut self, coordinator: &mut Coordinator) -> Result<()>;
fn update_layout(&mut self, layout_accessor: &mut LayoutAccessor);
fn is_input(&self) -> bool;
fn captures_enter(&self) -> bool;
fn update(&mut self, key: Key) -> bool;
}