map: clean up

This commit is contained in:
lunar-mining
2022-02-05 22:39:30 +01:00
parent 714552c660
commit 7244fb850a
4 changed files with 1 additions and 34 deletions

View File

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

View File

@@ -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();

View File

@@ -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);
//}

View File

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