Przeglądaj źródła

map: renamed run_app to render

lunar-mining 4 lat temu
rodzic
commit
aa80910d05
1 zmienionych plików z 5 dodań i 10 usunięć
  1. 5 10
      bin/map/src/main.rs

+ 5 - 10
bin/map/src/main.rs

@@ -139,7 +139,7 @@ async fn main() -> Result<()> {
         .finish(|| {
             smol::future::block_on(async move {
                 run_rpc(ex2.clone(), model.clone()).await?;
-                run_app(&mut terminal, model.clone()).await?;
+                render(&mut terminal, model.clone()).await?;
                 drop(signal);
                 Ok::<(), darkfi::Error>(())
             })
@@ -184,15 +184,11 @@ async fn poll(client: Map, _model: Model) -> Result<()> {
     }
 }
 
-async fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut model: Model) -> io::Result<()> {
+async fn render<B: Backend>(terminal: &mut Terminal<B>, model: Model) -> io::Result<()> {
     let mut asi = async_stdin();
 
     terminal.clear()?;
 
-    //model.id_list.state.select(Some(0));
-
-    //model.info_list.index = 0;
-
     let mut info_vec = Vec::new();
 
     for info in model.info_list.infos.clone() {
@@ -206,16 +202,15 @@ async fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut model: Model) -> io
     }
 
     let id_list = IdListView::new(id_vec);
+
     let info_list = InfoListView::new(info_vec);
+
     let mut view = View::new(id_list, info_list);
 
     view.id_list.state.select(Some(0));
 
     view.info_list.index = 0;
 
-    // acquire the mutex
-    // let mut model = model.lock();
-
     loop {
         terminal.draw(|f| {
             ui::ui(f, view.clone());
@@ -224,7 +219,7 @@ async fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut model: Model) -> io
             match k.unwrap() {
                 Key::Char('q') => {
                     terminal.clear()?;
-                    return Ok(())
+                    return Ok(());
                 }
                 Key::Char('j') => {
                     view.id_list.next();