1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use crossterm::event::KeyEvent;
use tty_interface::{Interface, Position};
use crate::{
dependency::DependencyState,
text::{DrawerContents, Segment},
Form,
};
mod compound;
pub use compound::*;
mod keyvalue;
pub use keyvalue::*;
mod textblock;
pub use textblock::*;
mod yesno;
pub use yesno::*;
pub trait Step {
fn initialize(&mut self, dependency_state: &mut DependencyState, index: usize);
fn render(
&self,
interface: &mut Interface,
dependency_state: &DependencyState,
position: Position,
is_focused: bool,
) -> u16;
fn update(
&mut self,
dependency_state: &mut DependencyState,
input: KeyEvent,
) -> Option<InputResult>;
fn help(&self) -> Segment;
fn drawer(&self) -> Option<DrawerContents>;
fn result(&self, dependency_state: &DependencyState) -> String;
fn add_to(self, form: &mut Form);
}
pub enum InputResult {
AdvanceForm,
RetreatForm,
}