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
|
mod app {
use crate::{WalkOptions, WalkResult};
use failure::Error;
use petgraph::{Directed, Graph};
use std::{ffi::OsString, io, path::PathBuf};
use termion::input::{Keys, TermReadEventsAndRaw};
use tui::{backend::Backend, Terminal};
pub type GraphIndexType = u32;
pub type Tree = Graph<ItemData, (), Directed, GraphIndexType>;
#[derive(Eq, PartialEq, Debug)]
pub struct ItemData {
pub name: OsString,
pub size: u64,
}
#[derive(Default, Debug)]
pub struct App {
pub tree: Tree,
}
impl App {
pub fn process_events<B, R>(
&mut self,
terminal: &mut Terminal<B>,
keys: Keys<R>,
) -> Result<WalkResult, Error>
where
B: Backend,
R: io::Read + TermReadEventsAndRaw,
{
unimplemented!()
}
pub fn initialize<B>(
terminal: &mut Terminal<B>,
options: WalkOptions,
input: Vec<PathBuf>,
) -> Result<App, Error>
where
B: Backend,
{
let tree = Tree::new();
Ok(App { tree })
}
}
}
pub use self::app::*;
|