|
|
@@ -16,31 +16,31 @@ impl App {
|
|
|
pub fn new() -> App {
|
|
|
let mut hashmap: HashMap<NodeId, NodeInfo> = HashMap::new();
|
|
|
|
|
|
- let id = Self::get_node_id();
|
|
|
- let info = Self::get_node_info();
|
|
|
+ let node_id = Self::get_node_id();
|
|
|
+ let node_info = Self::get_node_info();
|
|
|
|
|
|
- hashmap.insert(id, info);
|
|
|
+ for id in node_id.iter() {
|
|
|
+ for info in node_info.iter() {
|
|
|
+ hashmap.insert(id.to_string(), info.to_string());
|
|
|
+ }
|
|
|
+ }
|
|
|
App { node_list: StatefulList::new(hashmap) }
|
|
|
}
|
|
|
|
|
|
- fn get_node_id() -> String {
|
|
|
- let mut node_list = String::new();
|
|
|
- for num in 1..10000 {
|
|
|
- let new_nodes = format!("\n Node {}\n", num);
|
|
|
- node_list.push_str(&new_nodes);
|
|
|
+ fn get_node_id() -> Vec<String> {
|
|
|
+ let mut node_list = Vec::new();
|
|
|
+ for num in 1..100 {
|
|
|
+ let new_nodes = format!("\nNode {}\n", num);
|
|
|
+ node_list.push(new_nodes);
|
|
|
}
|
|
|
node_list
|
|
|
}
|
|
|
|
|
|
- fn get_node_info() -> String {
|
|
|
- let mut node_info = String::new();
|
|
|
- for num in 1..10000 {
|
|
|
- let new_info = format!(
|
|
|
- "\nConnections: {}\n
|
|
|
- \n Recent messages: ...",
|
|
|
- num
|
|
|
- );
|
|
|
- node_info.push_str(&new_info);
|
|
|
+ fn get_node_info() -> Vec<String> {
|
|
|
+ let mut node_info = Vec::new();
|
|
|
+ for num in 1..100 {
|
|
|
+ let new_info = format!("\nConnections: {}\n", num);
|
|
|
+ node_info.push(new_info);
|
|
|
}
|
|
|
node_info
|
|
|
}
|