Kaynağa Gözat

map: clean up

lunar-mining 4 yıl önce
ebeveyn
işleme
7244fb850a
4 değiştirilmiş dosya ile 1 ekleme ve 34 silme
  1. 0 1
      bin/map/src/lib.rs
  2. 1 1
      bin/map/src/main.rs
  3. 0 30
      bin/map/src/model.rs
  4. 0 2
      bin/map/src/types.rs

+ 0 - 1
bin/map/src/lib.rs

@@ -1,5 +1,4 @@
 pub mod model;
-pub mod types;
 pub mod ui;
 
 pub use model::{IdList, InfoList, Model, NodeInfo};

+ 1 - 1
bin/map/src/main.rs

@@ -203,7 +203,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') => {
                     model.id_list.next();

+ 0 - 30
bin/map/src/model.rs

@@ -1,11 +1,4 @@
 use tui::widgets::ListState;
-//use async_std::sync::Mutex;
-//use smol::Timer;
-//use std::{collections::HashMap, time::Duration};
-
-// make a structure to be able to modify and read them
-// protect using a mutex
-// arc reference
 
 #[derive(Clone)]
 pub struct Model {
@@ -15,19 +8,9 @@ pub struct Model {
 
 impl Model {
     pub fn new(id_list: IdList, info_list: InfoList) -> Model {
-        //let infos = Vec::new();
-        //let ids = Vec::new();
-
-        //let info_list = InfoList::new(infos);
-        //let id_list = IdList::new(ids);
         Model { id_list, info_list }
     }
 
-    // TODO: implement this
-    //async fn sleep(self, dur: Duration) {
-    //    Timer::after(dur).await;
-    //}
-
     pub async fn update(mut self, node_vec: Vec<NodeInfo>) -> Model {
         let ids = vec![node_vec[0].id.clone()];
 
@@ -116,15 +99,6 @@ impl InfoList {
     }
 }
 
-//impl Default for Model {
-//    fn default() -> Self {
-//        Self::new()
-//    }
-//}
-
-//TODO: made node_id into a HashSet(u32)
-// wrap NodeInfo and NodeId in a Mutex
-
 pub type NodeId = u32;
 
 #[derive(Clone)]
@@ -148,7 +122,3 @@ impl Default for NodeInfo {
         Self::new()
     }
 }
-
-//pub async fn add_seen(&self, id: u32) {
-//    self.privmsg_ids.lock().await.insert(id);
-//}

+ 0 - 2
bin/map/src/types.rs

@@ -1,2 +0,0 @@
-//pub type NodeId = String;
-//pub type NodeInfo = String;